net.sf.saxon.type

Class TypeHierarchy

public class TypeHierarchy extends Object implements Serializable

This class exists to provide answers to questions about the type hierarchy. Because such questions are potentially expensive, it caches the answers.
Field Summary
static intDISJOINT
Constant denoting relationship between two types: A is disjoint from B
static intOVERLAPS
Constant denoting relationship between two types: A overlaps B
static intSAME_TYPE
Constant denoting relationship between two types: A is the same type as B
static intSUBSUMED_BY
Constant denoting relationship between two types: A is subsumed by B
static intSUBSUMES
Constant denoting relationship between two types: A subsumes B
Constructor Summary
TypeHierarchy()
Method Summary
booleanisSubType(ItemType subtype, ItemType supertype)
Determine 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.

Field Detail

DISJOINT

public static final int DISJOINT
Constant denoting relationship between two types: A is disjoint from B

OVERLAPS

public static final int OVERLAPS
Constant denoting relationship between two types: A overlaps B

SAME_TYPE

public static final int SAME_TYPE
Constant denoting relationship between two types: A is the same type as B

SUBSUMED_BY

public static final int SUBSUMED_BY
Constant denoting relationship between two types: A is subsumed by B

SUBSUMES

public static final int SUBSUMES
Constant denoting relationship between two types: A subsumes B

Constructor Detail

TypeHierarchy

public TypeHierarchy()

Method Detail

isSubType

public boolean isSubType(ItemType subtype, ItemType supertype)
Determine whether type A is type B or one of its subtypes, recursively

Parameters: subtype identifies the first type supertype identifies the second type

Returns: true if the first type is the second type or a (direct or indirect) subtype of the second type

relationship

public int relationship(ItemType t1, ItemType t2)
Determine the relationship of one item type to another.

Parameters: t1 the first item type t2 the second item type

Returns: SAME_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)