com.xml_project.morganaxproc.xpath.type
Class SequenceType

java.lang.Object
  extended by com.xml_project.morganaxproc.xpath.type.SequenceType

public class SequenceType
extends Object

An object representing XPath's sequence type syntax


Nested Class Summary
static class SequenceType.OccurrenceIndicator
          Enumeration of the occurrence indicators (including empty)
 
Field Summary
static SequenceType ANY_ARRAY
           
static SequenceType ANY_MAP
           
static SequenceType ANY_SEQUENCE
           
static SequenceType ANYURI_ONE
           
static SequenceType BOOLEAN_ONE
           
static SequenceType BOOLEAN_ZERO_OR_ONE
           
static SequenceType DATE_TIME_ONE
           
static SequenceType DOUBLE_ONE
           
static SequenceType DOUBLE_ZERO_OR_ONE
           
static SequenceType EMPTY_SEQUENCE
           
static SequenceType EMPTY_TYPE
           
static SequenceType INTEGER_ONE
           
static SequenceType INTEGER_ZERO_OR_MORE
           
static SequenceType ITEM_ONE
           
static SequenceType ITEM_ZERO_OR_ONE
           
static SequenceType NCNAME_ONE
           
static SequenceType NODE_ONE
           
static SequenceType NODE_ONE_OR_MORE
           
static SequenceType NODE_ZERO_OR_MORE
           
static SequenceType NODE_ZERO_OR_ONE
           
static SequenceType NONE
           
static SequenceType QNAME_ONE
           
static SequenceType STRING_ONE
           
static SequenceType STRING_ONE_OR_MORE
           
static SequenceType STRING_ZERO_OR_MORE
           
static SequenceType STRING_ZERO_OR_ONE
           
static SequenceType TOKEN_ONE
           
 
Method Summary
 boolean checkCardinality(XdmSequence op)
          Checks whether the given XDM sequence has the cardinality if this sequence type
static boolean checkCardinality(XdmSequence aSequence, SequenceType.OccurrenceIndicator occ)
          Checks the cardinality of the given sequence.
static boolean checkItemType(XdmSequence aSequence, ItemType theItemType)
          Checks whether the all items in the given sequence match the given type.
 boolean fulfilledBy(SequenceType test)
          Tests whether this sequence type is fulfilled by another sequence type
 boolean fulfilledBy(SequenceType test, boolean checkPromotion)
          Tests whether this sequence type is fulfilled by another sequence type, optionally using type promotion
 ItemType getItemType()
          Gets the item Type represented by this sequence type.
 SequenceType.OccurrenceIndicator getOccurenceIndicator()
          gets the occurence indicator represented by this sequence type.
 boolean isAtomicType()
          Checks whether this SequenceType represents an atomic type
 boolean isAtomicType(Class<? extends XS_AnyType> type)
          Checks whether this Sequence represents a special atomic type
 boolean isValid()
           
static SequenceType makeSequenceType(Class<? extends XS_AnyType> anAtomicType)
          Makes a sequence type from the given XDM value type, cardinality exactly one.
static SequenceType makeSequenceType(Class<? extends XS_AnyType> anAtomicType, SequenceType.OccurrenceIndicator occ)
          Makes a sequence type from the given XDM value type and the given cardinality
static SequenceType makeSequenceType(ItemType item)
          Creates a sequence type representing the given item type, cardinality = exactly one.
static SequenceType makeSequenceType(ItemType item, SequenceType.OccurrenceIndicator occ)
          Create a sequence type representing the given item type and cardinality.
static SequenceType makeSequenceType(SequenceType orgType, SequenceType.OccurrenceIndicator occ)
          Makes a sequence type from another sequence type with the given cardinality
 boolean matches(XdmSequence aSequence)
          Checks whether the given XDM sequence matches this sequence type.
 String toString()
          Returns a string representation of this sequence type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_TYPE

public static final SequenceType EMPTY_TYPE

NONE

public static final SequenceType NONE

EMPTY_SEQUENCE

public static final SequenceType EMPTY_SEQUENCE

ANY_SEQUENCE

public static final SequenceType ANY_SEQUENCE

ITEM_ONE

public static final SequenceType ITEM_ONE

ITEM_ZERO_OR_ONE

public static final SequenceType ITEM_ZERO_OR_ONE

BOOLEAN_ONE

public static final SequenceType BOOLEAN_ONE

BOOLEAN_ZERO_OR_ONE

public static final SequenceType BOOLEAN_ZERO_OR_ONE

INTEGER_ONE

public static final SequenceType INTEGER_ONE

INTEGER_ZERO_OR_MORE

public static final SequenceType INTEGER_ZERO_OR_MORE

DOUBLE_ONE

public static final SequenceType DOUBLE_ONE

DOUBLE_ZERO_OR_ONE

public static final SequenceType DOUBLE_ZERO_OR_ONE

NODE_ZERO_OR_ONE

public static final SequenceType NODE_ZERO_OR_ONE

NODE_ONE

public static final SequenceType NODE_ONE

NODE_ZERO_OR_MORE

public static final SequenceType NODE_ZERO_OR_MORE

NODE_ONE_OR_MORE

public static final SequenceType NODE_ONE_OR_MORE

STRING_ZERO_OR_ONE

public static final SequenceType STRING_ZERO_OR_ONE

STRING_ONE

public static final SequenceType STRING_ONE

STRING_ZERO_OR_MORE

public static final SequenceType STRING_ZERO_OR_MORE

STRING_ONE_OR_MORE

public static final SequenceType STRING_ONE_OR_MORE

QNAME_ONE

public static final SequenceType QNAME_ONE

NCNAME_ONE

public static final SequenceType NCNAME_ONE

ANYURI_ONE

public static final SequenceType ANYURI_ONE

TOKEN_ONE

public static final SequenceType TOKEN_ONE

DATE_TIME_ONE

public static final SequenceType DATE_TIME_ONE

ANY_MAP

public static final SequenceType ANY_MAP

ANY_ARRAY

public static final SequenceType ANY_ARRAY
Method Detail

isValid

public boolean isValid()

isAtomicType

public boolean isAtomicType()
Checks whether this SequenceType represents an atomic type

Returns:
true, if it is an atomic type

isAtomicType

public boolean isAtomicType(Class<? extends XS_AnyType> type)
Checks whether this Sequence represents a special atomic type

Parameters:
type - the type to check for
Returns:
true, if this type is represented.

getItemType

public ItemType getItemType()
Gets the item Type represented by this sequence type.

Returns:
the item type

getOccurenceIndicator

public SequenceType.OccurrenceIndicator getOccurenceIndicator()
gets the occurence indicator represented by this sequence type.

Returns:
the occurence indicator

checkCardinality

public static boolean checkCardinality(XdmSequence aSequence,
                                       SequenceType.OccurrenceIndicator occ)
Checks the cardinality of the given sequence.

Parameters:
aSequence - the sequence to test.
occ - the cardinality to check for.
Returns:
return true, if the cardinality is ok.

makeSequenceType

public static SequenceType makeSequenceType(ItemType item)
Creates a sequence type representing the given item type, cardinality = exactly one.

Parameters:
item - the item type.
Returns:
a sequence type representing the item type.

makeSequenceType

public static SequenceType makeSequenceType(ItemType item,
                                            SequenceType.OccurrenceIndicator occ)
Create a sequence type representing the given item type and cardinality.

Parameters:
item - the item type
occ - the cardinality
Returns:
the sequence type

makeSequenceType

public static SequenceType makeSequenceType(Class<? extends XS_AnyType> anAtomicType)
Makes a sequence type from the given XDM value type, cardinality exactly one.

Parameters:
anAtomicType - the XDM value type.
Returns:
the sequence type

makeSequenceType

public static SequenceType makeSequenceType(Class<? extends XS_AnyType> anAtomicType,
                                            SequenceType.OccurrenceIndicator occ)
Makes a sequence type from the given XDM value type and the given cardinality

Parameters:
anAtomicType - the XDM value type
occ - the cardinality
Returns:
the sequence type

makeSequenceType

public static SequenceType makeSequenceType(SequenceType orgType,
                                            SequenceType.OccurrenceIndicator occ)
Makes a sequence type from another sequence type with the given cardinality

Parameters:
orgType - a sequence type
occ - the cardinality
Returns:
a new sequence type

checkItemType

public static boolean checkItemType(XdmSequence aSequence,
                                    ItemType theItemType)
                             throws XPathException
Checks whether the all items in the given sequence match the given type.

Parameters:
aSequence - the sequence to test.
theItemType - the item type to test for.
Returns:
true, if all items match item type.
Throws:
XPathException - raised, when an error occurred.

matches

public boolean matches(XdmSequence aSequence)
                throws XPathException
Checks whether the given XDM sequence matches this sequence type.

Parameters:
aSequence - the XDM sequence to test.
Returns:
true, if the sequence matches this sequence type.
Throws:
XPathException - raised, when an error occcurred.

checkCardinality

public boolean checkCardinality(XdmSequence op)
Checks whether the given XDM sequence has the cardinality if this sequence type

Parameters:
op - the sequence to test.
Returns:
true, if the cardinality is right

fulfilledBy

public boolean fulfilledBy(SequenceType test,
                           boolean checkPromotion)
                    throws XPathException
Tests whether this sequence type is fulfilled by another sequence type, optionally using type promotion

Parameters:
test - the sequence type to test
checkPromotion - - use type promotion or not.
Returns:
true, if the test succeeds.
Throws:
XPathException - raised, if an error occurred.

fulfilledBy

public boolean fulfilledBy(SequenceType test)
                    throws XPathException
Tests whether this sequence type is fulfilled by another sequence type

Parameters:
test - the sequence type to test
Returns:
true, if test succeeds.
Throws:
XPathException - raised, if an error occurred.

toString

public String toString()
Returns a string representation of this sequence type.

Overrides:
toString in class Object