net.sf.saxon.value

Class SequenceType

public final class SequenceType extends 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 SequenceTypeANY_SEQUENCE
A type that allows any sequence of items
static SequenceTypeATOMIC_SEQUENCE
A type that allows zero or more atomic values
static SequenceTypeEMPTY_SEQUENCE
A type that only permits the empty sequence
static SequenceTypeNODE_SEQUENCE
A type that allows a sequence of zero or more nodes
static SequenceTypeNUMERIC_SEQUENCE
A type that allows a sequence of zero or more numeric values
static SequenceTypeOPTIONAL_ANY_URI
A type that allows a single optional anyURI
static SequenceTypeOPTIONAL_ATOMIC
A type that allows zero or one atomic values
static SequenceTypeOPTIONAL_BOOLEAN
A type that allows a single optional integer
static SequenceTypeOPTIONAL_BYTE
A type that allows a single optional byte
static SequenceTypeOPTIONAL_DATE_TIME
A type that allows a single optional dateTime
static SequenceTypeOPTIONAL_DECIMAL
A type that allows a single optional decimal
static SequenceTypeOPTIONAL_DOCUMENT_NODE
A type that allows a single document node
static SequenceTypeOPTIONAL_DOUBLE
A type that allows a single optional double
static SequenceTypeOPTIONAL_FLOAT
A type that allows a single optional float
static SequenceTypeOPTIONAL_INT
A type that allows a single optional int
static SequenceTypeOPTIONAL_INTEGER
A type that allows a single optional integer
static SequenceTypeOPTIONAL_ITEM
A type that allows zero or one items, of any kind
static SequenceTypeOPTIONAL_LONG
A type that allows a single optional long
static SequenceTypeOPTIONAL_NODE
A type that allows zero or one nodes
static SequenceTypeOPTIONAL_NUMERIC
A type that allows an optional numeric value
static SequenceTypeOPTIONAL_QNAME
A type that allows a single optional xs:QName
static SequenceTypeOPTIONAL_SHORT
A type that allows a single optional short
static SequenceTypeOPTIONAL_STRING
A type that allows a single optional string
static SequenceTypeSINGLE_ATOMIC
A type that allows exactly one atomic value
static SequenceTypeSINGLE_BOOLEAN
A type that allows a single boolean
static SequenceTypeSINGLE_BYTE
A type that allows a single short
static SequenceTypeSINGLE_DOUBLE
A type that allows a single double
static SequenceTypeSINGLE_ELEMENT_NODE
A type that allows a single element node
static SequenceTypeSINGLE_FLOAT
A type that allows a single float
static SequenceTypeSINGLE_INT
A type that allows a single int
static SequenceTypeSINGLE_INTEGER
A type that allows a single integer
static SequenceTypeSINGLE_ITEM
A type that allows exactly one item, of any kind
static SequenceTypeSINGLE_LONG
A type that allows a single long
static SequenceTypeSINGLE_NODE
A type that allows a single node
static SequenceTypeSINGLE_SHORT
A type that allows a single short
static SequenceTypeSINGLE_STRING
A type that allows a single string
static SequenceTypeSINGLE_UNTYPED_ATOMIC
A type that allows a single untyped atomic
Method Summary
booleanequals(Object obj)
Indicates whether some other object is "equal to" this one.
intgetCardinality()
Get the cardinality component of this SequenceType.
ItemTypegetPrimaryType()
Get the "primary" part of this required type.
inthashCode()
Returns a hash code value for the object.
static SequenceTypemakeSequenceType(ItemType primaryType, int cardinality)
Construct an instance of SequenceType.
booleanmatches(Value value, Configuration config)
Determine whether a given value is a valid instance of this SequenceType
StringtoString()
Return a string representation of this SequenceType

Field Detail

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_ANY_URI

public static final SequenceType OPTIONAL_ANY_URI
A type that allows a single optional anyURI

OPTIONAL_ATOMIC

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

OPTIONAL_BOOLEAN

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

OPTIONAL_BYTE

public static final SequenceType OPTIONAL_BYTE
A type that allows a single optional byte

OPTIONAL_DATE_TIME

public static final SequenceType OPTIONAL_DATE_TIME
A type that allows a single optional dateTime

OPTIONAL_DECIMAL

public static final SequenceType OPTIONAL_DECIMAL
A type that allows a single optional decimal

OPTIONAL_DOCUMENT_NODE

public static final SequenceType OPTIONAL_DOCUMENT_NODE
A type that allows a single document node

OPTIONAL_DOUBLE

public static final SequenceType OPTIONAL_DOUBLE
A type that allows a single optional double

OPTIONAL_FLOAT

public static final SequenceType OPTIONAL_FLOAT
A type that allows a single optional float

OPTIONAL_INT

public static final SequenceType OPTIONAL_INT
A type that allows a single optional int

OPTIONAL_INTEGER

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

OPTIONAL_ITEM

public static final SequenceType OPTIONAL_ITEM
A type that allows zero or one items, of any kind

OPTIONAL_LONG

public static final SequenceType OPTIONAL_LONG
A type that allows a single optional long

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

OPTIONAL_QNAME

public static final SequenceType OPTIONAL_QNAME
A type that allows a single optional xs:QName

OPTIONAL_SHORT

public static final SequenceType OPTIONAL_SHORT
A type that allows a single optional short

OPTIONAL_STRING

public static final SequenceType OPTIONAL_STRING
A type that allows a single optional string

SINGLE_ATOMIC

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

SINGLE_BOOLEAN

public static final SequenceType SINGLE_BOOLEAN
A type that allows a single boolean

SINGLE_BYTE

public static final SequenceType SINGLE_BYTE
A type that allows a single short

SINGLE_DOUBLE

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

SINGLE_ELEMENT_NODE

public static final SequenceType SINGLE_ELEMENT_NODE
A type that allows a single element node

SINGLE_FLOAT

public static final SequenceType SINGLE_FLOAT
A type that allows a single float

SINGLE_INT

public static final SequenceType SINGLE_INT
A type that allows a single int

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_LONG

public static final SequenceType SINGLE_LONG
A type that allows a single long

SINGLE_NODE

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

SINGLE_SHORT

public static final SequenceType SINGLE_SHORT
A type that allows a single short

SINGLE_STRING

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

SINGLE_UNTYPED_ATOMIC

public static final SequenceType SINGLE_UNTYPED_ATOMIC
A type that allows a single untyped atomic

Method Detail

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

See Also: 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

matches

public boolean matches(Value value, Configuration config)
Determine whether a given value is a valid instance of this SequenceType

Parameters: value the value to be tested

Returns: true if the value is a valid instance of this type

toString

public String toString()
Return a string representation of this SequenceType

Returns: the string representation as an instance of the XPath SequenceType construct