public abstract class Type extends Object
The constant integers used for type names in earlier versions of this class have been replaced
by constants in StandardNames
. The constants representing AtomicType
objects are now
available through the BuiltInAtomicType
class.
Modifier and Type | Field and Description |
---|---|
static short |
ATTRIBUTE
Item type representing an attribute node - attribute()
|
static short |
COMMENT
Item type representing a comment node
|
static short |
DOCUMENT
Item type representing a document node
|
static short |
ELEMENT
Type representing an element node - element()
|
static short |
EMPTY
Item type that matches no items (corresponds to SequenceType empty())
|
static short |
FUNCTION
A type number for function()
|
static short |
ITEM
An item type that matches any item
|
static ItemType |
ITEM_TYPE |
static short |
MAX_NODE_TYPE |
static short |
NAMESPACE
Item type representing a namespace node
|
static short |
NODE
An item type that matches any node
|
static ItemType |
NODE_TYPE |
static short |
PARENT_POINTER
Dummy node kind used in the tiny tree to contain a parent pointer
|
static short |
PROCESSING_INSTRUCTION
Item type representing a processing-instruction node
|
static short |
STOPPER
Dummy node kind used in the tiny tree to mark the end of the tree
|
static short |
TEXT
Item type representing a text node - text()
|
static short |
WHITESPACE_TEXT
Item type representing a text node stored in the tiny tree as compressed whitespace
|
Modifier and Type | Method and Description |
---|---|
static String |
displayTypeName(Item item)
Output (for diagnostics) a representation of the type of an item.
|
static ItemType |
getBuiltInItemType(String namespace,
String localName)
Get the ItemType object for a built-in atomic type
|
static SimpleType |
getBuiltInSimpleType(String namespace,
String localName)
Get the SimpleType object for a built-in simple type (atomic type or list type)
|
static ItemType |
getCommonSuperType(ItemType t1,
ItemType t2)
Get a type that is a common supertype of two given item types, without the benefit of a TypeHierarchy cache.
|
static ItemType |
getCommonSuperType(ItemType t1,
ItemType t2,
TypeHierarchy th)
Get a type that is a common supertype of two given item types
|
static ItemType |
getItemType(Item item,
TypeHierarchy th)
Get the ItemType of an Item
|
static boolean |
isGenerallyComparable(BuiltInAtomicType t1,
BuiltInAtomicType t2,
boolean ordered)
Determine whether two primitive atomic types are comparable under the rules for GeneralComparisons
(that is, untyped atomic values treated as comparable to anything)
|
static boolean |
isGuaranteedComparable(BuiltInAtomicType t1,
BuiltInAtomicType t2,
boolean ordered)
Determine whether two primitive atomic types are comparable under the rules for ValueComparisons
(that is, untyped atomic values treated as strings)
|
static boolean |
isGuaranteedGenerallyComparable(BuiltInAtomicType t1,
BuiltInAtomicType t2,
boolean ordered)
Determine whether two primitive atomic types are guaranteed comparable under the rules for GeneralComparisons
(that is, untyped atomic values treated as comparable to anything).
|
static boolean |
isNodeType(ItemType type)
Test whether a given type is (some subtype of) node()
|
static boolean |
isPossiblyComparable(BuiltInAtomicType t1,
BuiltInAtomicType t2,
boolean ordered)
Determine whether two primitive atomic types are comparable under the rules for ValueComparisons
(that is, untyped atomic values treated as strings)
|
static boolean |
isPrimitiveType(int code)
Determine whether this type is a primitive type.
|
static boolean |
isSubType(AtomicType one,
AtomicType two)
Determine whether one atomic type is a subtype of another (without access to the TypeHierarchy object)
|
public static final short ELEMENT
public static final short ATTRIBUTE
public static final short TEXT
public static final short WHITESPACE_TEXT
public static final short PROCESSING_INSTRUCTION
public static final short COMMENT
public static final short DOCUMENT
public static final short NAMESPACE
public static final short STOPPER
public static final short PARENT_POINTER
public static final short NODE
public static final ItemType NODE_TYPE
public static final short ITEM
public static final ItemType ITEM_TYPE
public static final short FUNCTION
public static final short MAX_NODE_TYPE
public static final short EMPTY
public static boolean isNodeType(ItemType type)
type
- The type to be testedpublic static ItemType getItemType(Item item, TypeHierarchy th)
item
- the item whose type is requiredth
- the type hierarchy cache. If null, the returned type may be less precisepublic static String displayTypeName(Item item)
item
- the item whose type is to be displayedpublic static ItemType getBuiltInItemType(String namespace, String localName)
namespace
- the namespace URI of the typelocalName
- the local name of the typepublic static SimpleType getBuiltInSimpleType(String namespace, String localName)
namespace
- the namespace URI of the typelocalName
- the local name of the typepublic static boolean isSubType(AtomicType one, AtomicType two)
one
- the first atomic typetwo
- the second atomic typepublic static ItemType getCommonSuperType(ItemType t1, ItemType t2, TypeHierarchy th)
t1
- the first item typet2
- the second item typeth
- the type hierarchy cachepublic static ItemType getCommonSuperType(ItemType t1, ItemType t2)
getCommonSuperType(ItemType, ItemType, TypeHierarchy)
t1
- the first item typet2
- the second item typepublic static boolean isPrimitiveType(int code)
code
- the item type code to be testedpublic static boolean isGuaranteedComparable(BuiltInAtomicType t1, BuiltInAtomicType t2, boolean ordered)
t1
- the first type to compared.
This must be a primitive atomic type as defined by ItemType.getPrimitiveType()
t2
- the second type to compared.
This must be a primitive atomic type as defined by ItemType.getPrimitiveType()
ordered
- true if testing for an ordering comparison (lt, gt, le, ge). False
if testing for an equality comparison (eq, ne)public static boolean isPossiblyComparable(BuiltInAtomicType t1, BuiltInAtomicType t2, boolean ordered)
t1
- the first type to compared.
This must be a primitive atomic type as defined by ItemType.getPrimitiveType()
t2
- the second type to compared.
This must be a primitive atomic type as defined by ItemType.getPrimitiveType()
ordered
- true if testing for an ordering comparison (lt, gt, le, ge). False
if testing for an equality comparison (eq, ne)public static boolean isGenerallyComparable(BuiltInAtomicType t1, BuiltInAtomicType t2, boolean ordered)
t1
- the first type to compared.
This must be a primitive atomic type as defined by ItemType.getPrimitiveType()
t2
- the second type to compared.
This must be a primitive atomic type as defined by ItemType.getPrimitiveType()
ordered
- true if testing for an ordering comparison (lt, gt, le, ge). False
if testing for an equality comparison (eq, ne)public static boolean isGuaranteedGenerallyComparable(BuiltInAtomicType t1, BuiltInAtomicType t2, boolean ordered)
t1
- the first type to compared.
This must be a primitive atomic type as defined by ItemType.getPrimitiveType()
t2
- the second type to compared.
This must be a primitive atomic type as defined by ItemType.getPrimitiveType()
ordered
- true if testing for an ordering comparison (lt, gt, le, ge). False
if testing for an equality comparison (eq, ne)Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.