Qizx/Open v0.4p2

net.xfra.qizxopen.xquery
Class Type

java.lang.Object
  |
  +--net.xfra.qizxopen.xquery.Type
Direct Known Subclasses:
ItemType

public class Type
extends java.lang.Object

Superclass of all Type representations.


Field Summary
static Type ANY
           
static net.xfra.qizxopen.xquery.dt.AtomicType ANY_ATOMIC_TYPE
           
static QName anyType
           
static net.xfra.qizxopen.xquery.dt.AtomicType ANYURI
           
static net.xfra.qizxopen.xquery.dt.AtomicType ATOM
           
static net.xfra.qizxopen.xquery.dt.NodeType ATTRIBUTE
           
static net.xfra.qizxopen.xquery.dt.AtomicType BASE64_BINARY
           
static net.xfra.qizxopen.xquery.dt.AtomicType BINARY
           
static net.xfra.qizxopen.xquery.dt.AtomicType BOOLEAN
           
static net.xfra.qizxopen.xquery.dt.AtomicType BYTE
           
static net.xfra.qizxopen.xquery.dt.AtomicType CHAR
           
static net.xfra.qizxopen.xquery.dt.NodeType COMMENT
           
static net.xfra.qizxopen.xquery.dt.AtomicType DATE
           
static net.xfra.qizxopen.xquery.dt.AtomicType DATE_TIME
           
static net.xfra.qizxopen.xquery.dt.AtomicType DAY_TIME_DURATION
           
static net.xfra.qizxopen.xquery.dt.AtomicType DECIMAL
           
static net.xfra.qizxopen.xquery.dt.NodeType DOCUMENT
           
static net.xfra.qizxopen.xquery.dt.AtomicType DOUBLE
           
static net.xfra.qizxopen.xquery.dt.AtomicType DURATION
           
static net.xfra.qizxopen.xquery.dt.NodeType ELEMENT
           
static net.xfra.qizxopen.xquery.dt.AtomicType ENTITY
           
static java.lang.String ERR_EMPTY_UNEXPECTED
           
static java.lang.String ERR_TOO_MANY
           
static java.lang.String ERR_TYPE_MISMATCH
           
static net.xfra.qizxopen.xquery.dt.AtomicType FLOAT
           
static net.xfra.qizxopen.xquery.dt.AtomicType G_DAY
           
static net.xfra.qizxopen.xquery.dt.AtomicType G_MONTH
           
static net.xfra.qizxopen.xquery.dt.AtomicType G_MONTH_DAY
           
static net.xfra.qizxopen.xquery.dt.AtomicType G_YEAR
           
static net.xfra.qizxopen.xquery.dt.AtomicType G_YEAR_MONTH
           
static net.xfra.qizxopen.xquery.dt.AtomicType HEX_BINARY
           
static net.xfra.qizxopen.xquery.dt.AtomicType ID
           
static net.xfra.qizxopen.xquery.dt.AtomicType IDREF
           
static net.xfra.qizxopen.xquery.dt.AtomicType INT
           
static net.xfra.qizxopen.xquery.dt.AtomicType INTEGER
           
static ItemType ITEM
           
static net.xfra.qizxopen.xquery.dt.AtomicType LANGUAGE
           
static net.xfra.qizxopen.xquery.dt.AtomicType LONG
           
static net.xfra.qizxopen.xquery.dt.AtomicType MOMENT
           
static byte MULTI_OCC
           
static net.xfra.qizxopen.xquery.dt.AtomicType NAME
           
static net.xfra.qizxopen.xquery.dt.NodeType NAMESPACE
           
static net.xfra.qizxopen.xquery.dt.AtomicType NCNAME
           
static net.xfra.qizxopen.xquery.dt.AtomicType NEGATIVE_INTEGER
           
static net.xfra.qizxopen.xquery.dt.AtomicType NMTOKEN
           
static net.xfra.qizxopen.xquery.dt.NodeType NODE
           
static net.xfra.qizxopen.xquery.dt.AtomicType NON_NEGATIVE_INTEGER
           
static net.xfra.qizxopen.xquery.dt.AtomicType NON_POSITIVE_INTEGER
           
static ItemType NONE
           
static net.xfra.qizxopen.xquery.dt.AtomicType NORMALIZED_STRING
           
static net.xfra.qizxopen.xquery.dt.AtomicType NOTATION
           
static net.xfra.qizxopen.xquery.dt.AtomicType NUMERIC
           
static net.xfra.qizxopen.xquery.dt.AtomicType OBJECT
           
static byte ONE_OCC
           
static byte OPT_OCC
           
static byte OPTMULTI_OCC
           
static net.xfra.qizxopen.xquery.dt.NodeType PI
           
static net.xfra.qizxopen.xquery.dt.AtomicType POSITIVE_INTEGER
           
static net.xfra.qizxopen.xquery.dt.AtomicType QNAME
           
static net.xfra.qizxopen.xquery.dt.AtomicType SHORT
           
static net.xfra.qizxopen.xquery.dt.AtomicType STRING
           
static net.xfra.qizxopen.xquery.dt.NodeType TEXT
           
static net.xfra.qizxopen.xquery.dt.AtomicType TIME
           
static net.xfra.qizxopen.xquery.dt.AtomicType TOKEN
           
static net.xfra.qizxopen.xquery.dt.AtomicType UNSIGNED_BYTE
           
static net.xfra.qizxopen.xquery.dt.AtomicType UNSIGNED_INT
           
static net.xfra.qizxopen.xquery.dt.AtomicType UNSIGNED_LONG
           
static net.xfra.qizxopen.xquery.dt.AtomicType UNSIGNED_SHORT
           
static net.xfra.qizxopen.xquery.dt.AtomicType UNTYPED_ATOMIC
           
static QName untypedAtomic
           
static net.xfra.qizxopen.xquery.dt.AtomicType WRAPPED_OBJECT
           
static net.xfra.qizxopen.xquery.dt.AtomicType YEAR_MONTH_DURATION
           
 
Constructor Summary
Type()
           
 
Method Summary
 boolean accepts(Type expressionType)
          Static type checking.
 boolean acceptsItem(Item item)
          Dynamic matching of a single item.
 Value check(Value value)
          Dynamic matching.
 Value convertFromObject(java.lang.Object object)
          Conversion of external Java objects to internal values.
 java.lang.Object convertToObject(net.xfra.qizxopen.xquery.op.Expression expr, Focus focus, EvalContext context)
          Conversion of internal values to external Java objects.
 void dump(ExprDump d)
           
static ItemType findItemType(QName typeName)
          Searches a predefined Item Type by name.
 ItemType getItemType()
          If this is a sequence type, return the item type, otherwise return the type itself.
 QName getName()
           
 int getOccurrence()
          If this is a sequence type, return the occurrence indicator, otherwise return ONE_OCC, except for anyType which is '*'.
 java.lang.String getShortName()
           
static boolean isOptional(int occ)
           
static boolean isRepeatable(int occ)
           
 boolean test(Value value)
          Tests that a value matches a type.
 java.lang.String toString()
           
 java.lang.String toString(StaticContext ctx)
           
 Type unionWith(Type that)
          Returns a type encompassing types this and that.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ONE_OCC

public static final byte ONE_OCC
See Also:
Constant Field Values

OPT_OCC

public static final byte OPT_OCC
See Also:
Constant Field Values

MULTI_OCC

public static final byte MULTI_OCC
See Also:
Constant Field Values

OPTMULTI_OCC

public static final byte OPTMULTI_OCC
See Also:
Constant Field Values

ERR_EMPTY_UNEXPECTED

public static final java.lang.String ERR_EMPTY_UNEXPECTED
See Also:
Constant Field Values

ERR_TOO_MANY

public static final java.lang.String ERR_TOO_MANY
See Also:
Constant Field Values

ERR_TYPE_MISMATCH

public static final java.lang.String ERR_TYPE_MISMATCH
See Also:
Constant Field Values

anyType

public static QName anyType

untypedAtomic

public static QName untypedAtomic

ANY

public static Type ANY

NONE

public static ItemType NONE

ITEM

public static ItemType ITEM

NODE

public static net.xfra.qizxopen.xquery.dt.NodeType NODE

ELEMENT

public static net.xfra.qizxopen.xquery.dt.NodeType ELEMENT

DOCUMENT

public static net.xfra.qizxopen.xquery.dt.NodeType DOCUMENT

ATTRIBUTE

public static net.xfra.qizxopen.xquery.dt.NodeType ATTRIBUTE

TEXT

public static net.xfra.qizxopen.xquery.dt.NodeType TEXT

PI

public static net.xfra.qizxopen.xquery.dt.NodeType PI

COMMENT

public static net.xfra.qizxopen.xquery.dt.NodeType COMMENT

NAMESPACE

public static net.xfra.qizxopen.xquery.dt.NodeType NAMESPACE

ATOM

public static net.xfra.qizxopen.xquery.dt.AtomicType ATOM

ANY_ATOMIC_TYPE

public static net.xfra.qizxopen.xquery.dt.AtomicType ANY_ATOMIC_TYPE

MOMENT

public static net.xfra.qizxopen.xquery.dt.AtomicType MOMENT

TIME

public static net.xfra.qizxopen.xquery.dt.AtomicType TIME

DATE

public static net.xfra.qizxopen.xquery.dt.AtomicType DATE

DATE_TIME

public static net.xfra.qizxopen.xquery.dt.AtomicType DATE_TIME

G_DAY

public static net.xfra.qizxopen.xquery.dt.AtomicType G_DAY

G_MONTH

public static net.xfra.qizxopen.xquery.dt.AtomicType G_MONTH

G_YEAR

public static net.xfra.qizxopen.xquery.dt.AtomicType G_YEAR

G_YEAR_MONTH

public static net.xfra.qizxopen.xquery.dt.AtomicType G_YEAR_MONTH

G_MONTH_DAY

public static net.xfra.qizxopen.xquery.dt.AtomicType G_MONTH_DAY

DURATION

public static net.xfra.qizxopen.xquery.dt.AtomicType DURATION

UNTYPED_ATOMIC

public static net.xfra.qizxopen.xquery.dt.AtomicType UNTYPED_ATOMIC

BOOLEAN

public static net.xfra.qizxopen.xquery.dt.AtomicType BOOLEAN

BINARY

public static net.xfra.qizxopen.xquery.dt.AtomicType BINARY

HEX_BINARY

public static net.xfra.qizxopen.xquery.dt.AtomicType HEX_BINARY

BASE64_BINARY

public static net.xfra.qizxopen.xquery.dt.AtomicType BASE64_BINARY

NUMERIC

public static net.xfra.qizxopen.xquery.dt.AtomicType NUMERIC

FLOAT

public static net.xfra.qizxopen.xquery.dt.AtomicType FLOAT

DOUBLE

public static net.xfra.qizxopen.xquery.dt.AtomicType DOUBLE

DECIMAL

public static net.xfra.qizxopen.xquery.dt.AtomicType DECIMAL

INTEGER

public static net.xfra.qizxopen.xquery.dt.AtomicType INTEGER

NON_POSITIVE_INTEGER

public static net.xfra.qizxopen.xquery.dt.AtomicType NON_POSITIVE_INTEGER

NEGATIVE_INTEGER

public static net.xfra.qizxopen.xquery.dt.AtomicType NEGATIVE_INTEGER

LONG

public static net.xfra.qizxopen.xquery.dt.AtomicType LONG

INT

public static net.xfra.qizxopen.xquery.dt.AtomicType INT

SHORT

public static net.xfra.qizxopen.xquery.dt.AtomicType SHORT

BYTE

public static net.xfra.qizxopen.xquery.dt.AtomicType BYTE

NON_NEGATIVE_INTEGER

public static net.xfra.qizxopen.xquery.dt.AtomicType NON_NEGATIVE_INTEGER

UNSIGNED_LONG

public static net.xfra.qizxopen.xquery.dt.AtomicType UNSIGNED_LONG

UNSIGNED_INT

public static net.xfra.qizxopen.xquery.dt.AtomicType UNSIGNED_INT

UNSIGNED_SHORT

public static net.xfra.qizxopen.xquery.dt.AtomicType UNSIGNED_SHORT

UNSIGNED_BYTE

public static net.xfra.qizxopen.xquery.dt.AtomicType UNSIGNED_BYTE

POSITIVE_INTEGER

public static net.xfra.qizxopen.xquery.dt.AtomicType POSITIVE_INTEGER

STRING

public static net.xfra.qizxopen.xquery.dt.AtomicType STRING

NORMALIZED_STRING

public static net.xfra.qizxopen.xquery.dt.AtomicType NORMALIZED_STRING

TOKEN

public static net.xfra.qizxopen.xquery.dt.AtomicType TOKEN

LANGUAGE

public static net.xfra.qizxopen.xquery.dt.AtomicType LANGUAGE

NAME

public static net.xfra.qizxopen.xquery.dt.AtomicType NAME

NCNAME

public static net.xfra.qizxopen.xquery.dt.AtomicType NCNAME

ID

public static net.xfra.qizxopen.xquery.dt.AtomicType ID

IDREF

public static net.xfra.qizxopen.xquery.dt.AtomicType IDREF

ENTITY

public static net.xfra.qizxopen.xquery.dt.AtomicType ENTITY

NMTOKEN

public static net.xfra.qizxopen.xquery.dt.AtomicType NMTOKEN

NOTATION

public static net.xfra.qizxopen.xquery.dt.AtomicType NOTATION

QNAME

public static net.xfra.qizxopen.xquery.dt.AtomicType QNAME

ANYURI

public static net.xfra.qizxopen.xquery.dt.AtomicType ANYURI

OBJECT

public static net.xfra.qizxopen.xquery.dt.AtomicType OBJECT

WRAPPED_OBJECT

public static net.xfra.qizxopen.xquery.dt.AtomicType WRAPPED_OBJECT

YEAR_MONTH_DURATION

public static net.xfra.qizxopen.xquery.dt.AtomicType YEAR_MONTH_DURATION

DAY_TIME_DURATION

public static net.xfra.qizxopen.xquery.dt.AtomicType DAY_TIME_DURATION

CHAR

public static net.xfra.qizxopen.xquery.dt.AtomicType CHAR
Constructor Detail

Type

public Type()
Method Detail

isOptional

public static boolean isOptional(int occ)

isRepeatable

public static boolean isRepeatable(int occ)

accepts

public boolean accepts(Type expressionType)
Static type checking. Tells whether a static expression type can be accepted by this formal type.


check

public Value check(Value value)
            throws XQueryException
Dynamic matching. Tells whether a dynamic value can be accepted by this type. This can imply checking both the item types and the length of the sequence.

Parameters:
value - value to test.
Returns:
if OK: an expanded value (ArraySequence or SingleItem).
XQueryException

test

public boolean test(Value value)
             throws XQueryException
Tests that a value matches a type.

XQueryException

acceptsItem

public boolean acceptsItem(Item item)
Dynamic matching of a single item. For optimization of typeswitch.


unionWith

public Type unionWith(Type that)
Returns a type encompassing types this and that. TODO? optimize


getItemType

public ItemType getItemType()
If this is a sequence type, return the item type, otherwise return the type itself.


getOccurrence

public int getOccurrence()
If this is a sequence type, return the occurrence indicator, otherwise return ONE_OCC, except for anyType which is '*'.


getName

public QName getName()

getShortName

public java.lang.String getShortName()

toString

public java.lang.String toString(StaticContext ctx)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

dump

public void dump(ExprDump d)

convertFromObject

public Value convertFromObject(java.lang.Object object)
Conversion of external Java objects to internal values.


convertToObject

public java.lang.Object convertToObject(net.xfra.qizxopen.xquery.op.Expression expr,
                                        Focus focus,
                                        EvalContext context)
                                 throws XQueryException
Conversion of internal values to external Java objects.

XQueryException

findItemType

public static ItemType findItemType(QName typeName)
Searches a predefined Item Type by name. Returns null if none found.


 Copyright Xavier FRANC 2003-2004