Package net.sf.saxon.type
Class UType
java.lang.Object
net.sf.saxon.type.UType
A UType is a union of primitive (atomic, node, or function) item types. It is represented as a simple
integer, with bits representing which of the primitive types are present in the union.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UTypestatic final UType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet a set containing all the primitive types in this UTypebooleanIndicates whether some other object is "equal to" this one.static UTypefromTypeCode(int code) static UTypegetUType(GroundedValue sequence) Get the UType of a Sequencestatic UTypeGet the UType of an IteminthashCode()Returns a hash code value for the object.intersection(UType other) static booleanisGenerallyComparable(UType t1, UType t2) Determine whether two primitive atomic types are comparable under the rules for GeneralComparisons for the "=" operator (that is, untyped atomic values treated as comparable to anything)static booleanisGuaranteedComparable(UType t1, UType t2) Determine whether two primitive atomic types are comparable under the rules for ValueComparisons (that is, untyped atomic values treated as strings), using the "eq" operatorstatic booleanisPossiblyComparable(UType t1, UType t2, boolean ordered) Determine whether two primitive atomic types are comparable under the rules for ValueComparisons (that is, untyped atomic values treated as strings)booleanAsk whether a given Item is an instance of this UTypebooleanDetermine whether two UTypes have overlapping membershipbooleanAsk whether one UType subsumes anotherObtain (that is, create or get) an itemType that matches all items whose primitive type is one of the types present in this UType.toString()Produce a string representation of a UTypeForm a UType as the union of two other UTypes
-
Field Details
-
VOID
-
DOCUMENT
-
ELEMENT
-
ATTRIBUTE
-
TEXT
-
COMMENT
-
PI
-
NAMESPACE
-
FUNCTION
-
STRING
-
BOOLEAN
-
DECIMAL
-
FLOAT
-
DOUBLE
-
DURATION
-
DATE_TIME
-
TIME
-
DATE
-
G_YEAR_MONTH
-
G_YEAR
-
G_MONTH_DAY
-
G_DAY
-
G_MONTH
-
HEX_BINARY
-
BASE64_BINARY
-
ANY_URI
-
QNAME
-
NOTATION
-
UNTYPED_ATOMIC
-
EXTENSION
-
NUMERIC
-
STRING_LIKE
-
CHILD_NODE_KINDS
-
PARENT_NODE_KINDS
-
ELEMENT_OR_ATTRIBUTE
-
ANY_NODE
-
ANY_ATOMIC
-
ANY
-
-
Constructor Details
-
UType
public UType(int bits)
-
-
Method Details
-
hashCode
public int hashCode()Returns a hash code value for the object. -
equals
Indicates whether some other object is "equal to" this one. -
union
Form a UType as the union of two other UTypes- Parameters:
other- the other UType- Returns:
- the UType representing the union of this UType and the other UType
-
intersection
-
except
-
fromTypeCode
-
decompose
Get a set containing all the primitive types in this UType- Returns:
- a set of PrimitiveUTypes each of which represents exactly one primitive type
-
toString
Produce a string representation of a UType -
toStringWithIndefiniteArticle
-
overlaps
Determine whether two UTypes have overlapping membership- Parameters:
other- the second UType- Returns:
- true if the intersection between the two UTypes is non-empty
-
subsumes
Ask whether one UType subsumes another- Parameters:
other- the second UType- Returns:
- true if every item type allowed by this UType is also allowed by the other item type
-
toItemType
Obtain (that is, create or get) an itemType that matches all items whose primitive type is one of the types present in this UType.- Returns:
- a corresponding ItemType
-
matches
Ask whether a given Item is an instance of this UType- Parameters:
item- the item to be tested- Returns:
- true if this UType matches the supplied item
-
getUType
Get the UType of an Item- Parameters:
item- the item whose UType is required- Returns:
- the UType of the item
-
getUType
Get the UType of a Sequence- Parameters:
sequence- the sequence whose UType is required- Returns:
- the UType of the item
-
isPossiblyComparable
Determine whether two primitive atomic types are comparable under the rules for ValueComparisons (that is, untyped atomic values treated as strings)- Parameters:
t1- the first type to compared. This must be a primitive atomic type as defined byItemType.getPrimitiveType()t2- the second type to compared. This must be a primitive atomic type as defined byItemType.getPrimitiveType()ordered- true if testing for an ordering comparison (lt, gt, le, ge). False if testing for an equality comparison (eq, ne)- Returns:
- true if the types are guaranteed comparable, as defined by the rules of the "eq" operator, or if we don't yet know (because some subtypes of the static type are comparable and others are not). False if they are definitely not comparable.
-
isGuaranteedComparable
Determine whether two primitive atomic types are comparable under the rules for ValueComparisons (that is, untyped atomic values treated as strings), using the "eq" operator- Parameters:
t1- the first type to compared. This must be a primitive atomic type as defined byItemType.getPrimitiveType()t2- the second type to compared. This must be a primitive atomic type as defined byItemType.getPrimitiveType()- Returns:
- true if the types are comparable, as defined by the rules of the "eq" operator; false if they are not comparable, or if we don't yet know (because some subtypes of the static type are comparable and others are not)
-
isGenerallyComparable
Determine whether two primitive atomic types are comparable under the rules for GeneralComparisons for the "=" operator (that is, untyped atomic values treated as comparable to anything)- Parameters:
t1- the first type to compared. This must be a primitive atomic type as defined byItemType.getPrimitiveType()t2- the second type to compared. This must be a primitive atomic type as defined byItemType.getPrimitiveType()- Returns:
- true if the types are comparable, as defined by the rules of the "=" operator
-