org.basex.query.value.type
Enum AtomType

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

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

XQuery data 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
AAT
          Any atomic type.
AST
          Any simple type.
ATM
          Untyped Atomic type.
ATY
          Any type.
B64
          Base64 binary type.
BIN
          Implementation specific: binary type.
BLN
          Boolean type.
BYT
          Byte type.
DAT
          Date type.
DAY
          Day type.
DBL
          Double type.
DEC
          Decimal type.
DTD
          Day time duration type.
DTM
          DateTime type.
DTS
          DateTimeStamp type.
DUR
          Duration type.
ENT
          Entity type.
FLT
          Float type.
HEX
          Hex binary type.
ID
          ID type.
IDR
          IDREF type.
INT
          Int type.
ITEM
          Item type.
ITR
          Integer type.
JAVA
          Java type.
LAN
          Language type.
LNG
          Long type.
MDA
          Month day type.
MON
          Month type.
NAM
          Name type.
NCN
          NCName type.
NIN
          Negative integer type.
NMT
          NMTOKEN type.
NNI
          Non-negative integer type.
NOT
          NOTATION Type.
NPI
          Non-positive integer type.
NST
          Normalized String type.
PDC
          Precision decimal type.
PIN
          Positive integer type.
QNM
          QName Type.
SHR
          Short type.
STR
          String type.
TIM
          Time type.
TOK
          Token type.
UBY
          Unsigned byte type.
UIN
          Short type.
ULN
          Unsigned long type.
URI
          Any URI type.
USH
          Unsigned Short type.
UTY
          Untyped type.
YEA
          Year type.
YMD
          Year month duration type.
YMO
          Year month type.
 
Field Summary
 QNm name
          Name.
 AtomType par
          Parent type.
static AtomType[] VALUES
          Cached enums (faster).
 
Method Summary
 Item cast(Item it, QueryContext ctx, InputInfo ii)
          Casts the specified item to the XQuery data type.
 Item cast(java.lang.Object o, QueryContext ctx, InputInfo ii)
          Casts the specified Java object to the XQuery data type.
 Item castString(java.lang.String o, QueryContext ctx, InputInfo ii)
          Casts the specified string to the XQuery data type.
 boolean eq(Type t)
          Checks if this type is equal to the given one.
static AtomType find(QNm type, boolean all)
          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 AtomType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static AtomType[] 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

ITEM

public static final AtomType ITEM
Item type.


UTY

public static final AtomType UTY
Untyped type.


ATY

public static final AtomType ATY
Any type.


AST

public static final AtomType AST
Any simple type.


AAT

public static final AtomType AAT
Any atomic type.


ATM

public static final AtomType ATM
Untyped Atomic type.


STR

public static final AtomType STR
String type.


NST

public static final AtomType NST
Normalized String type.


TOK

public static final AtomType TOK
Token type.


LAN

public static final AtomType LAN
Language type.


NMT

public static final AtomType NMT
NMTOKEN type.


NAM

public static final AtomType NAM
Name type.


NCN

public static final AtomType NCN
NCName type.


ID

public static final AtomType ID
ID type.


IDR

public static final AtomType IDR
IDREF type.


ENT

public static final AtomType ENT
Entity type.


FLT

public static final AtomType FLT
Float type.


DBL

public static final AtomType DBL
Double type.


DEC

public static final AtomType DEC
Decimal type.


PDC

public static final AtomType PDC
Precision decimal type.


ITR

public static final AtomType ITR
Integer type.


NPI

public static final AtomType NPI
Non-positive integer type.


NIN

public static final AtomType NIN
Negative integer type.


LNG

public static final AtomType LNG
Long type.


INT

public static final AtomType INT
Int type.


SHR

public static final AtomType SHR
Short type.


BYT

public static final AtomType BYT
Byte type.


NNI

public static final AtomType NNI
Non-negative integer type.


ULN

public static final AtomType ULN
Unsigned long type.


UIN

public static final AtomType UIN
Short type.


USH

public static final AtomType USH
Unsigned Short type.


UBY

public static final AtomType UBY
Unsigned byte type.


PIN

public static final AtomType PIN
Positive integer type.


DUR

public static final AtomType DUR
Duration type.


YMD

public static final AtomType YMD
Year month duration type.


DTD

public static final AtomType DTD
Day time duration type.


DTM

public static final AtomType DTM
DateTime type.


DTS

public static final AtomType DTS
DateTimeStamp type.


DAT

public static final AtomType DAT
Date type.


TIM

public static final AtomType TIM
Time type.


YMO

public static final AtomType YMO
Year month type.


YEA

public static final AtomType YEA
Year type.


MDA

public static final AtomType MDA
Month day type.


DAY

public static final AtomType DAY
Day type.


MON

public static final AtomType MON
Month type.


BLN

public static final AtomType BLN
Boolean type.


BIN

public static final AtomType BIN
Implementation specific: binary type.


B64

public static final AtomType B64
Base64 binary type.


HEX

public static final AtomType HEX
Hex binary type.


URI

public static final AtomType URI
Any URI type.


QNM

public static final AtomType QNM
QName Type.


NOT

public static final AtomType NOT
NOTATION Type.


JAVA

public static final AtomType JAVA
Java type.

Field Detail

VALUES

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


name

public final QNm name
Name.


par

public final AtomType par
Parent type.

Method Detail

values

public static AtomType[] 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 (AtomType c : AtomType.values())
    System.out.println(c);

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

valueOf

public static AtomType 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

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 Item 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 Item 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 Item 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

toString

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

find

public static AtomType find(QNm type,
                            boolean all)
Finds and returns the specified data type.

Parameters:
type - type as string
all - accept all types (include those without parent type)
Returns:
type or null

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