org.basex.query.value.type
Enum ListType

java.lang.Object
  extended by java.lang.Enum<ListType>
      extended by org.basex.query.value.type.ListType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ListType>, Type

public enum ListType
extends java.lang.Enum<ListType>
implements Type

XQuery list types.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.basex.query.value.type.Type
Type.ID
 
Enum Constant Summary
ENT
          ENTITIES type.
IDR
          IDREFS type.
NMT
          NMTOKENS type.
 
Field Summary
static ListType[] VALUES
          Cached enums (faster).
 
Method Summary
abstract  Value cast(Item it, QueryContext ctx, InputInfo ii)
          Casts the specified item to the XQuery data type.
 Value cast(java.lang.Object o, QueryContext ctx, InputInfo ii)
          Casts the specified Java object to the XQuery data type.
 Value castString(java.lang.String o, QueryContext ctx, InputInfo ii)
          Casts the specified string to the XQuery data type.
protected static Value create(Item it, QueryContext ctx, InputInfo ii, AtomType type)
          Creates a sequence with the resulting list items.
 boolean eq(Type t)
          Checks if this type is equal to the given one.
static ListType find(QNm type)
          Finds and returns the specified data type.
 Type.ID id()
          Returns a type id to differentiate all types.
 boolean instanceOf(Type t)
          Checks if the current type is an instance of the specified type.
 Type intersect(Type t)
          Computes the intersection between this type and the given one, i.e.
 boolean isNode()
          Checks if the type refers to a node.
 boolean isNumber()
          Checks if the type refers to a number.
 boolean isNumberOrUntyped()
          Checks if the type refers to a number or an untyped item.
 boolean isStringOrUntyped()
          Checks if the type refers to a number or a string.
 boolean isUntyped()
          Checks if the type refers to an untyped item.
 boolean nsSensitive()
          Checks if the type is namespace-sensitive.
 SeqType seqType()
          Returns the sequence type of this data type.
 byte[] string()
          Returns the string representation of this type.
 java.lang.String toString()
           
 Type union(Type t)
          Computes the union between this type and the given one, i.e.
static ListType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static ListType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NMT

public static final ListType NMT
NMTOKENS type.


ENT

public static final ListType ENT
ENTITIES type.


IDR

public static final ListType IDR
IDREFS type.

Field Detail

VALUES

public static final ListType[] VALUES
Cached enums (faster).

Method Detail

values

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

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

valueOf

public static ListType 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
java.lang.NullPointerException - if the argument is null

create

protected static Value create(Item it,
                              QueryContext ctx,
                              InputInfo ii,
                              AtomType type)
                       throws QueryException
Creates a sequence with the resulting list items.

Parameters:
it - item
ctx - query context
ii - input info
type - result type
Returns:
created value
Throws:
QueryException - query exception

find

public static ListType find(QNm type)
Finds and returns the specified data type.

Parameters:
type - type as string
Returns:
type or null

isNumber

public boolean isNumber()
Description copied from interface: Type
Checks if the type refers to a number.

Specified by:
isNumber in interface Type
Returns:
result of check

isUntyped

public boolean isUntyped()
Description copied from interface: Type
Checks if the type refers to an untyped item.

Specified by:
isUntyped in interface Type
Returns:
result of check

isNumberOrUntyped

public boolean isNumberOrUntyped()
Description copied from interface: Type
Checks if the type refers to a number or an untyped item.

Specified by:
isNumberOrUntyped in interface Type
Returns:
result of check

isStringOrUntyped

public boolean isStringOrUntyped()
Description copied from interface: Type
Checks if the type refers to a number or a string. Returns if this item is untyped or a string.

Specified by:
isStringOrUntyped in interface Type
Returns:
result of check

string

public byte[] string()
Description copied from interface: Type
Returns the string representation of this type.

Specified by:
string in interface Type
Returns:
name

cast

public abstract Value cast(Item it,
                           QueryContext ctx,
                           InputInfo ii)
                    throws QueryException
Description copied from interface: Type
Casts the specified item to the XQuery data type.

Specified by:
cast in interface Type
Parameters:
it - item to be converted
ctx - query context
ii - input info
Returns:
new item
Throws:
QueryException - query exception

cast

public Value cast(java.lang.Object o,
                  QueryContext ctx,
                  InputInfo ii)
           throws QueryException
Description copied from interface: Type
Casts the specified Java object to the XQuery data type.

Specified by:
cast in interface Type
Parameters:
o - Java object
ctx - TODO
ii - input info
Returns:
new item
Throws:
QueryException - query exception

castString

public Value castString(java.lang.String o,
                        QueryContext ctx,
                        InputInfo ii)
                 throws QueryException
Description copied from interface: Type
Casts the specified string to the XQuery data type.

Specified by:
castString in interface Type
Parameters:
o - string object
ctx - TODO
ii - input info
Returns:
new item
Throws:
QueryException - query exception

seqType

public SeqType seqType()
Description copied from interface: Type
Returns the sequence type of this data type.

Specified by:
seqType in interface Type
Returns:
sequence type

eq

public boolean eq(Type t)
Description copied from interface: Type
Checks if this type is equal to the given one.

Specified by:
eq in interface Type
Parameters:
t - other type
Returns:
true if both types are equal, false otherwise

instanceOf

public final boolean instanceOf(Type t)
Description copied from interface: Type
Checks if the current type is an instance of the specified type.

Specified by:
instanceOf in interface Type
Parameters:
t - type to be checked
Returns:
result of check

union

public Type union(Type t)
Description copied from interface: Type
Computes the union between this type and the given one, i.e. the least common ancestor of both types in the type hierarchy.

Specified by:
union in interface Type
Parameters:
t - other type
Returns:
union type

intersect

public Type intersect(Type t)
Description copied from interface: Type
Computes the intersection between this type and the given one, i.e. the least specific type that is sub-type of both types. If no such type exists, null is returned.

Specified by:
intersect in interface Type
Parameters:
t - other type
Returns:
intersection type or null

isNode

public final boolean isNode()
Description copied from interface: Type
Checks if the type refers to a node.

Specified by:
isNode in interface Type
Returns:
result of check

id

public Type.ID id()
Description copied from interface: Type
Returns a type id to differentiate all types.

Specified by:
id in interface Type
Returns:
id

nsSensitive

public boolean nsSensitive()
Description copied from interface: Type
Checks if the type is namespace-sensitive.

Specified by:
nsSensitive in interface Type
Returns:
result of check

toString

public java.lang.String toString()
Specified by:
toString in interface Type
Overrides:
toString in class java.lang.Enum<ListType>