org.qtitools.qti.value
Class FloatValue

java.lang.Object
  extended by org.qtitools.qti.value.SingleValue
      extended by org.qtitools.qti.value.NumberValue
          extended by org.qtitools.qti.value.FloatValue
All Implemented Interfaces:
java.io.Serializable, Value

public class FloatValue
extends NumberValue

Implementation of BaseType float value.

Float data type is defined as the IEEE double-precision 64-bit floating point type.

Example values: 1, 3.14, +3.14, -3.14, 3E+08, +3E+08, -3E+08, 3E-08, +3E-08, -3E-08.

See XML for more more accurately definition.

This class is not mutable and cannot contain NULL value.

Cardinality of this class is always single and BaseType is always float.

Author:
Jiri Kajaba
See Also:
Cardinality, BaseType, Serialized Form

Constructor Summary
FloatValue(double value)
          Constructs FloatValue from given double.
FloatValue(java.lang.String value)
          Constructs FloatValue from given String representation.
 
Method Summary
 double doubleValue()
          Returns the value of this NumberValue as A double.
 boolean equals(java.lang.Object object)
           
 BaseType getBaseType()
          Returns baseType of this value.
 int hashCode()
           
 int intValue()
          Returns the value of this NumberValue as A int.
static double parseFloat(java.lang.String value)
          Parses the String argument as A double.
 java.lang.String toString()
           
 
Methods inherited from class org.qtitools.qti.value.SingleValue
getCardinality, isNull
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FloatValue

public FloatValue(double value)
Constructs FloatValue from given double.

Parameters:
value - double

FloatValue

public FloatValue(java.lang.String value)
           throws QTIParseException
Constructs FloatValue from given String representation.

Parameters:
value - String representation of FloatValue
Throws:
QTIParseException - if String representation of FloatValue is not valid
Method Detail

getBaseType

public BaseType getBaseType()
Description copied from interface: Value
Returns baseType of this value.

If value is NULL or record cardinality returns null.

Returns:
baseType of this value

intValue

public int intValue()
Description copied from class: NumberValue
Returns the value of this NumberValue as A int.

Specified by:
intValue in class NumberValue
Returns:
the value of this NumberValue as A int

doubleValue

public double doubleValue()
Description copied from class: NumberValue
Returns the value of this NumberValue as A double.

Specified by:
doubleValue in class NumberValue
Returns:
the value of this NumberValue as A double

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

parseFloat

public static double parseFloat(java.lang.String value)
                         throws QTIParseException
Parses the String argument as A double.

Parameters:
value - String representation of double
Returns:
parsed double
Throws:
QTIParseException - if String representation of double is not valid


Copyright © 2009. All Rights Reserved.