org.qtitools.qti.value
Class BooleanValue

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

public class BooleanValue
extends SingleValue

Implementation of BaseType boolean value.

Legal String representations of boolean value are: true, 1, false, 0.

This class is not mutable and cannot contain NULL value.

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

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

Constructor Summary
BooleanValue(boolean value)
          Constructs BooleanValue from given boolean.
BooleanValue(java.lang.String value)
          Constructs BooleanValue from given String representation.
 
Method Summary
 boolean booleanValue()
          Returns the value of this BooleanValue as A boolean.
 boolean equals(java.lang.Object object)
           
 BaseType getBaseType()
          Returns baseType of this value.
 int hashCode()
           
static boolean parseBoolean(java.lang.String value)
          Parses the String argument as A boolean.
 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

BooleanValue

public BooleanValue(boolean value)
Constructs BooleanValue from given boolean.

Parameters:
value - boolean

BooleanValue

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

Parameters:
value - String representation of BooleanValue
Throws:
QTIParseException - if String representation of BooleanValue 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

booleanValue

public boolean booleanValue()
Returns the value of this BooleanValue as A boolean.

Returns:
the value of this BooleanValue as A boolean

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

parseBoolean

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

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


Copyright © 2009. All Rights Reserved.