Package net.sf.saxon.type
Class TypeHierarchy
java.lang.Object
net.sf.saxon.type.TypeHierarchy
- All Implemented Interfaces:
Serializable
This class exists to provide answers to questions about the type hierarchy. Because
such questions are potentially expensive, it caches the answers. There is one instance of
this class for a Configuration.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant denoting relationship between two types: A is disjoint from Bstatic final intConstant denoting relationship between two types: A overlaps Bstatic final intConstant denoting relationship between two types: A is the same type as Bstatic final intConstant denoting relationship between two types: A is subsumed by Bstatic final intConstant denoting relationship between two types: A subsumes B -
Constructor Summary
ConstructorsConstructorDescriptionTypeHierarchy(Configuration config) Create the type hierarchy cache for a configuration -
Method Summary
Modifier and TypeMethodDescriptionGet the Saxon configuration to which this type hierarchy belongsbooleanisIdCode(int typeCode) Test whether a type annotation code represents the type xs:ID or one of its subtypesbooleanisIdrefsCode(int typeCode) Test whether a type annotation code represents the type xs:IDREF, xs:IDREFS or one of their subtypesbooleanDetermine whether type A is type B or one of its subtypes, recursively.intrelationship(ItemType t1, ItemType t2) Determine the relationship of one item type to another.static intGet the relationship of two schema types to each other
-
Field Details
-
SAME_TYPE
public static final int SAME_TYPEConstant denoting relationship between two types: A is the same type as B- See Also:
-
SUBSUMES
public static final int SUBSUMESConstant denoting relationship between two types: A subsumes B- See Also:
-
SUBSUMED_BY
public static final int SUBSUMED_BYConstant denoting relationship between two types: A is subsumed by B- See Also:
-
OVERLAPS
public static final int OVERLAPSConstant denoting relationship between two types: A overlaps B- See Also:
-
DISJOINT
public static final int DISJOINTConstant denoting relationship between two types: A is disjoint from B- See Also:
-
-
Constructor Details
-
TypeHierarchy
Create the type hierarchy cache for a configuration- Parameters:
config- the configuration
-
-
Method Details
-
getConfiguration
Get the Saxon configuration to which this type hierarchy belongs- Returns:
- the configuration
-
isSubType
Determine whether type A is type B or one of its subtypes, recursively. "Subtype" here means a type that is subsumed, that is, a type whose instances are a subset of the instances of the other type.- Parameters:
subtype- identifies the first typesupertype- identifies the second type- Returns:
- true if the first type is the second type or is subsumed by the second type
-
relationship
Determine the relationship of one item type to another.- Parameters:
t1- the first item typet2- the second item type- Returns:
SAME_TYPEif the types are the same;SUBSUMESif the first type subsumes the second (that is, all instances of the second type are also instances of the first);SUBSUMED_BYif the second type subsumes the first;OVERLAPSif the two types overlap (have a non-empty intersection, but neither subsumes the other);DISJOINTif the two types are disjoint (have an empty intersection)
-
isIdCode
public boolean isIdCode(int typeCode) Test whether a type annotation code represents the type xs:ID or one of its subtypes- Parameters:
typeCode- the type annotation to be tested- Returns:
- true if the type annotation represents an xs:ID
-
isIdrefsCode
public boolean isIdrefsCode(int typeCode) Test whether a type annotation code represents the type xs:IDREF, xs:IDREFS or one of their subtypes- Parameters:
typeCode- the type annotation to be tested- Returns:
- true if the type annotation represents an xs:IDREF or xs:IDREFS or a subtype thereof
-
schemaTypeRelationship
Get the relationship of two schema types to each other- Parameters:
s1- the first types2- the second type- Returns:
- the relationship of the two types, as one of the constants
SAME_TYPE,SUBSUMES,SUBSUMED_BY,DISJOINT
-