org.qtitools.qti.value
Class IntegerValue

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

public class IntegerValue
extends NumberValue

Implementation of BaseType integer value.

An integer value is A whole number in the range [-2147483648, 2147483647].

Example values: 1, +3, -4.

This class is not mutable and cannot contain NULL value.

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

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

Constructor Summary
IntegerValue(int value)
          Constructs IntegerValue from given int.
IntegerValue(java.lang.String value)
          Constructs IntegerValue from given String representation.
IntegerValue(java.lang.String value, java.lang.Integer radix)
          Constructs IntegerValue from given String representation and radix.
 
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 int parseInteger(java.lang.String value)
          Parses the String argument as A int.
static int parseInteger(java.lang.String value, int radix)
          Parses the String argument as A int.
 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

IntegerValue

public IntegerValue(int value)
Constructs IntegerValue from given int.

Parameters:
value - int

IntegerValue

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

Parameters:
value - String representation of IntegerValue
Throws:
QTIParseException - if String representation of IntegerValue is not valid

IntegerValue

public IntegerValue(java.lang.String value,
                    java.lang.Integer radix)
Constructs IntegerValue from given String representation and radix.

Parameters:
value - String representation of IntegerValue
radix - Radix or base to use when interpreting value
Throws:
QTIParseException - if String representation of IntegerValue 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

parseInteger

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

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

parseInteger

public static int parseInteger(java.lang.String value,
                               int radix)
                        throws QTIParseException
Parses the String argument as A int.

Parameters:
value - String representation of int
radix - base to use in conversion
Returns:
parsed int
Throws:
QTIParseException - if String representation of int is not valid


Copyright © 2009. All Rights Reserved.