org.qtitools.qti.value
Enum Cardinality

java.lang.Object
  extended by java.lang.Enum<Cardinality>
      extended by org.qtitools.qti.value.Cardinality
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Cardinality>

public enum Cardinality
extends java.lang.Enum<Cardinality>

This class describes cardinality of value. Supported cardinalities are:

single - one value

multiple - unordered list of values of same type

ordered - ordered list of values of same type

record - unordered list of values of different types

Author:
Jiri Kajaba

Enum Constant Summary
MULTIPLE
          Set of single values (order is not important).
ORDERED
          Ordered list of single values (order is important).
RECORD
          Set of (key, value) pairs (order is not important).
SINGLE
          One single value.
 
Field Summary
static java.lang.String CLASS_TAG
          Name of this class in xml schema.
 
Method Summary
static Cardinality[] intersection(Cardinality[] firstSet, Cardinality[] secondSet)
          Returns intersection of two given cardinalities sets (order is not important).
 boolean isList()
          Returns true if this cardinality is multiple or ordered; false otherwise.
 boolean isMultiple()
          Returns true if this cardinality is multiple; false otherwise.
 boolean isOrdered()
          Returns true if this cardinality is ordered; false otherwise.
 boolean isRecord()
          Returns true if this cardinality is record; false otherwise.
 boolean isSingle()
          Returns true if this cardinality is single; false otherwise.
static Cardinality parseCardinality(java.lang.String cardinality)
          Returns parsed Cardinality from given String.
 java.lang.String toString()
           
static Cardinality valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Cardinality[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

SINGLE

public static final Cardinality SINGLE
One single value.


MULTIPLE

public static final Cardinality MULTIPLE
Set of single values (order is not important).


ORDERED

public static final Cardinality ORDERED
Ordered list of single values (order is important).


RECORD

public static final Cardinality RECORD
Set of (key, value) pairs (order is not important). Key must be an identifier. Value can be any baseType.

Field Detail

CLASS_TAG

public static final java.lang.String CLASS_TAG
Name of this class in xml schema.

See Also:
Constant Field Values
Method Detail

values

public static final Cardinality[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(Cardinality c : Cardinality.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static Cardinality valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

isSingle

public boolean isSingle()
Returns true if this cardinality is single; false otherwise.

Returns:
true if this cardinality is single; false otherwise

isList

public boolean isList()
Returns true if this cardinality is multiple or ordered; false otherwise.

Returns:
true if this cardinality is multiple or ordered; false otherwise

isMultiple

public boolean isMultiple()
Returns true if this cardinality is multiple; false otherwise.

Returns:
true if this cardinality is multiple; false otherwise

isOrdered

public boolean isOrdered()
Returns true if this cardinality is ordered; false otherwise.

Returns:
true if this cardinality is ordered; false otherwise

isRecord

public boolean isRecord()
Returns true if this cardinality is record; false otherwise.

Returns:
true if this cardinality is record; false otherwise

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Enum<Cardinality>

parseCardinality

public static Cardinality parseCardinality(java.lang.String cardinality)
                                    throws QTIParseException
Returns parsed Cardinality from given String.

Parameters:
cardinality - String representation of Cardinality
Returns:
parsed Cardinality from given String
Throws:
QTIParseException - if given String is not valid Cardinality

intersection

public static Cardinality[] intersection(Cardinality[] firstSet,
                                         Cardinality[] secondSet)
Returns intersection of two given cardinalities sets (order is not important).

Parameters:
firstSet - first set of cardinalities
secondSet - second set of cardinalities
Returns:
intersection of two given cardinalities sets


Copyright © 2009. All Rights Reserved.