public class TypeHierarchy extends Object
Modifier and Type | Field and Description |
---|---|
protected Configuration |
config |
static int |
DISJOINT
Constant denoting relationship between two types: A is disjoint from B
|
static int |
OVERLAPS
Constant denoting relationship between two types: A overlaps B
|
static int |
SAME_TYPE
Constant denoting relationship between two types: A is the same type as B
|
static int |
SUBSUMED_BY
Constant denoting relationship between two types: A is subsumed by B
|
static int |
SUBSUMES
Constant denoting relationship between two types: A subsumes B
|
Constructor and Description |
---|
TypeHierarchy(Configuration config)
Create the type hierarchy cache for a configuration
|
Modifier and Type | Method and Description |
---|---|
protected SequenceIterator |
applyFunctionCoercion(SequenceIterator iterator,
ItemType suppliedItemType,
ItemType requiredItemType,
RoleLocator role,
Container locator)
Apply function coercion when function items are supplied as arguments to a function call.
|
Sequence |
applyFunctionConversionRules(Sequence value,
SequenceType requiredType,
RoleLocator role,
Container locator)
Apply the function conversion rules to a value, given a required type.
|
protected int |
computeContentRelationship(ItemType t1,
ItemType t2,
IntSet n1,
IntSet n2)
Compute the relationship between the allowed content-types of two types,
for example attribute(*, xs:integer) and attribute(xs:string).
|
Configuration |
getConfiguration()
Get the Saxon configuration to which this type hierarchy belongs
|
ItemType |
getGenericFunctionItemType() |
boolean |
isIdCode(int typeCode)
Test whether a type annotation code represents the type xs:ID or one of its subtypes
|
boolean |
isIdrefsCode(int typeCode)
Test whether a type annotation code represents the type xs:IDREF, xs:IDREFS or one of their subtypes
|
boolean |
isSubType(ItemType subtype,
ItemType supertype)
Determine whether type A is type B or one of its subtypes, recursively.
|
int |
relationship(ItemType t1,
ItemType t2)
Determine the relationship of one item type to another.
|
static int |
schemaTypeRelationship(SchemaType s1,
SchemaType s2)
Get the relationship of two schema types to each other
|
protected Configuration config
public static final int SAME_TYPE
public static final int SUBSUMES
public static final int SUBSUMED_BY
public static final int OVERLAPS
public static final int DISJOINT
public TypeHierarchy(Configuration config)
config
- the configurationpublic Sequence applyFunctionConversionRules(Sequence value, SequenceType requiredType, RoleLocator role, Container locator) throws XPathException
value
- a value to be convertedrequiredType
- the required typerole
- identifies the value to be converted in error messageslocator
- identifies the location for error messagesXPathException
- if the value cannot be converted to the required typeprotected SequenceIterator applyFunctionCoercion(SequenceIterator iterator, ItemType suppliedItemType, ItemType requiredItemType, RoleLocator role, Container locator)
iterator
- An iterator over the supplied value of the parametersuppliedItemType
- the item type of the supplied valuerequiredItemType
- the required item type (typically a function item type)role
- information for diagnosticslocator
- information for diagnosticspublic Configuration getConfiguration()
public boolean isSubType(ItemType subtype, ItemType supertype)
subtype
- identifies the first typesupertype
- identifies the second typepublic int relationship(ItemType t1, ItemType t2)
t1
- the first item typet2
- the second item typeSAME_TYPE
if the types are the same; SUBSUMES
if the first
type subsumes the second (that is, all instances of the second type are also instances
of the first); SUBSUMED_BY
if the second type subsumes the first;
OVERLAPS
if the two types overlap (have a non-empty intersection, but neither
subsumes the other); DISJOINT
if the two types are disjoint (have an empty intersection)protected int computeContentRelationship(ItemType t1, ItemType t2, IntSet n1, IntSet n2)
t1
- the first typet2
- the second typesn1
- the set of element names allowed by the first typen2
- the set of element names allowed by the second typepublic static int schemaTypeRelationship(SchemaType s1, SchemaType s2)
s1
- the first types2
- the second typeSAME_TYPE
, SUBSUMES
,
SUBSUMED_BY
, DISJOINT
public ItemType getGenericFunctionItemType()
public boolean isIdCode(int typeCode)
typeCode
- the type annotation to be testedpublic boolean isIdrefsCode(int typeCode)
typeCode
- the type annotation to be testedCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.