/** * Parses a new floatOrVariableRef from the given String, as defined in the QTI spec. * * @throws QtiParseException */ public static FloatOrVariableRef parseString(final String string) { Assert.notNull(string); if (string.isEmpty()) { throw new QtiParseException("floatOrVariableRef must not be empty"); } try { /* Try to parse as a float */ final double floatValue = DataTypeBinder.parseFloat(string); return new FloatOrVariableRef(floatValue); } catch (final QtiParseException e) { /* Try to parse as a variable reference */ final Identifier variableReferenceIdentifier = Identifier.parseString(string); return new FloatOrVariableRef(variableReferenceIdentifier); } }