net.sf.saxon.value

Class SequenceType

Implemented Interfaces:
Serializable

public final class SequenceType
extends java.lang.Object
implements Serializable

SequenceType: a sequence type consists of a primary type, which indicates the type of item, and a cardinality, which indicates the number of occurrences permitted. Where the primary type is element or attribute, there may also be a content type, indicating the required type annotation on the element or attribute content.

Field Summary

static SequenceType
ANY_SEQUENCE
A type that allows any sequence of items
static SequenceType
ATOMIC_SEQUENCE
A type that allows zero or more atomic values
static SequenceType
EMPTY_SEQUENCE
A type that only permits the empty sequence
static SequenceType
NODE_SEQUENCE
A type that allows a sequence of zero or more nodes
static SequenceType
NUMERIC_SEQUENCE
A type that allows a sequence of zero or more numeric values
static SequenceType
OPTIONAL_ATOMIC
A type that allows zero or one atomic values
static SequenceType
OPTIONAL_INTEGER
A type that allows a single optional integer
static SequenceType
OPTIONAL_NODE
A type that allows zero or one nodes
static SequenceType
OPTIONAL_NUMERIC
A type that allows an optional numeric value
static SequenceType
SINGLE_ATOMIC
A type that allows exactly one atomic value
static SequenceType
SINGLE_DOUBLE
A type that allows a single double
static SequenceType
SINGLE_INTEGER
A type that allows a single integer
static SequenceType
SINGLE_ITEM
A type that allows exactly one item, of any kind
static SequenceType
SINGLE_NODE
A type that allows a single node
static SequenceType
SINGLE_STRING
A type that allows a single string

Method Summary

boolean
equals(Object obj)
Indicates whether some other object is "equal to" this one.
int
getCardinality()
Get the cardinality component of this SequenceType.
ItemType
getPrimaryType()
Get the "primary" part of this required type.
int
hashCode()
Returns a hash code value for the object.
static SequenceType
makeSequenceType(ItemType primaryType, int cardinality)
Construct an instance of SequenceType.
String
toString()
Return a string representation of this SequenceType

Field Details

ANY_SEQUENCE

public static final SequenceType ANY_SEQUENCE
A type that allows any sequence of items

ATOMIC_SEQUENCE

public static final SequenceType ATOMIC_SEQUENCE
A type that allows zero or more atomic values

EMPTY_SEQUENCE

public static final SequenceType EMPTY_SEQUENCE
A type that only permits the empty sequence

NODE_SEQUENCE

public static final SequenceType NODE_SEQUENCE
A type that allows a sequence of zero or more nodes

NUMERIC_SEQUENCE

public static final SequenceType NUMERIC_SEQUENCE
A type that allows a sequence of zero or more numeric values

OPTIONAL_ATOMIC

public static final SequenceType OPTIONAL_ATOMIC
A type that allows zero or one atomic values

OPTIONAL_INTEGER

public static final SequenceType OPTIONAL_INTEGER
A type that allows a single optional integer

OPTIONAL_NODE

public static final SequenceType OPTIONAL_NODE
A type that allows zero or one nodes

OPTIONAL_NUMERIC

public static final SequenceType OPTIONAL_NUMERIC
A type that allows an optional numeric value

SINGLE_ATOMIC

public static final SequenceType SINGLE_ATOMIC
A type that allows exactly one atomic value

SINGLE_DOUBLE

public static final SequenceType SINGLE_DOUBLE
A type that allows a single double

SINGLE_INTEGER

public static final SequenceType SINGLE_INTEGER
A type that allows a single integer

SINGLE_ITEM

public static final SequenceType SINGLE_ITEM
A type that allows exactly one item, of any kind

SINGLE_NODE

public static final SequenceType SINGLE_NODE
A type that allows a single node

SINGLE_STRING

public static final SequenceType SINGLE_STRING
A type that allows a single string

Method Details

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.

getCardinality

public int getCardinality()
Get the cardinality component of this SequenceType. This is one of the constants Cardinality.EXACTLY_ONE, Cardinality.ONE_OR_MORE, etc
Returns:
the required cardinality

getPrimaryType

public ItemType getPrimaryType()
Get the "primary" part of this required type. E.g. for type element(*, xs:date) the "primary type" is element()
Returns:
The item type code of the primary type

hashCode

public int hashCode()
Returns a hash code value for the object.

makeSequenceType

public static SequenceType makeSequenceType(ItemType primaryType,
                                            int cardinality)
Construct an instance of SequenceType. This is a factory method: it maintains a pool of SequenceType objects to reduce the amount of object creation.
Parameters:
primaryType - The item type
cardinality - The required cardinality

toString

public String toString()
Return a string representation of this SequenceType
Returns:
the string representation as an instance of the XPath SequenceType construct