Package net.sf.saxon.type.gnode
Class NodeKindType
java.lang.Object
net.sf.saxon.type.gnode.GNodeType
net.sf.saxon.type.gnode.XNodeType
net.sf.saxon.type.gnode.NodeKindType
- All Implemented Interfaces:
NodePredicate,NodeTest,NodeVectorMatchMaker,ItemType,ItemTypeWithSequenceTypeCache
A
NodeKindType matches one of the seven kinds of XNode.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NodeKindTypestatic final NodeKindTypestatic final NodeKindTypestatic final NodeKindTypestatic final NodeKindTypestatic final NodeKindTypestatic final NodeKindType -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringdescribe(int kind) booleanIndicates whether some other object is "equal to" this one.explainMismatch(Item item, TypeHierarchy th) Get extra diagnostic information about why a supplied item does not conform to this item type, if available.Get the set of allowed node names that this type if capable of matchingGet the content type allowed by this NodeTest (that is, the type annotation).Get an alphabetic code representing the type, or at any rate, the nearest built-in type from which this type is derived.final doubleDetermine the default priority of this node test when used on its own as a PatterngetGenre()Determine the Genre (top-level classification) of this typegetMatcher(NodeVectorTree tree) Get a matching function that can be used to test whether numbered nodes in a TinyTree or DominoTree satisfy the node test.intGet the node kind matched by this testintDetermine the types of nodes to which this pattern applies.getUType()Get the correspondingUType.inthashCode()Returns a hash code value for the object.booleanAsk whether values of this type are atomizablestatic GNodeTypemakeNodeKindTest(int kind) Make a test for a given kind of nodebooleanTest whether a given item conforms to this typestatic StringnodeKindName(int kind) Get the name of a node kindstatic NodeKindTypeof(int nodeKind) toString()Methods inherited from class net.sf.saxon.type.gnode.XNodeType
asXNodeTest, getCoercionPlan, getContentType, getRequiredFingerprint, isNillableMethods inherited from class net.sf.saxon.type.gnode.GNodeType
getItemType, getPrimitiveItemType, getQNameTest, isAtomicType, isPlainType, one, oneOrMore, test, toShortString, zeroOrMore, zeroOrOneMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.sf.saxon.type.ItemType
asChoiceItemType, getNormalizedDefaultPriority, normalizeItemType, toExportString
-
Field Details
-
DOCUMENT
-
ELEMENT
-
ATTRIBUTE
-
TEXT
-
COMMENT
-
PROCESSING_INSTRUCTION
-
NAMESPACE
-
-
Method Details
-
getGenre
Determine the Genre (top-level classification) of this type -
of
-
getNodeKind
public int getNodeKind()Get the node kind matched by this test- Returns:
- the matching node kind
-
getAllowedNodeNames
Get the set of allowed node names that this type if capable of matching- Specified by:
getAllowedNodeNamesin classXNodeType- Returns:
- the allowed node names
-
getUType
Get the correspondingUType. A UType is a union of primitive item types. -
makeNodeKindTest
Make a test for a given kind of node -
getMatcher
Get a matching function that can be used to test whether numbered nodes in a TinyTree or DominoTree satisfy the node test. (Calling this matcher must give the same result as callingmatchesNode(tree.getNode(nodeNr)), but it may well be faster).- Specified by:
getMatcherin interfaceNodeVectorMatchMaker- Parameters:
tree- the tree against which the returned function will operate- Returns:
- an IntPredicate; the matches() method of this predicate takes a node number as input, and returns true if and only if the node identified by this node number matches the node predicate.
-
isAtomizable
Ask whether values of this type are atomizable- Specified by:
isAtomizablein interfaceItemType- Overrides:
isAtomizablein classGNodeType- Parameters:
th- the type hierarchy cache- Returns:
- true if some or all instances of this type can be successfully atomized; false if no instances of this type can be atomized
-
matches
Description copied from class:GNodeTypeTest whether a given item conforms to this type -
getDefaultPriority
public final double getDefaultPriority()Determine the default priority of this node test when used on its own as a Pattern- Specified by:
getDefaultPriorityin interfaceItemType- Specified by:
getDefaultPriorityin interfaceNodeTest- Returns:
- the default priority
-
getPrimitiveType
public int getPrimitiveType()Determine the types of nodes to which this pattern applies. Used for optimisation.- Specified by:
getPrimitiveTypein interfaceItemType- Overrides:
getPrimitiveTypein classGNodeType- Returns:
- the type of node matched by this pattern. e.g. Type.ELEMENT or Type.TEXT
-
getAtomizedItemType
Get the content type allowed by this NodeTest (that is, the type annotation). Return AnyType if there are no restrictions. The default implementation returns AnyType.- Specified by:
getAtomizedItemTypein interfaceItemType- Overrides:
getAtomizedItemTypein classGNodeType- Returns:
- the best available item type of the atomic values that will be produced when an item of this type is atomized, or null if it is known that atomization will throw an error.
-
toString
-
describe
-
nodeKindName
Get the name of a node kind- Parameters:
kind- the node kind, for example Type.ELEMENT or Type.ATTRIBUTE- Returns:
- the name of the node kind, for example "element" or "attribute"
-
hashCode
public int hashCode()Returns a hash code value for the object. -
equals
Indicates whether some other object is "equal to" this one. -
explainMismatch
Get extra diagnostic information about why a supplied item does not conform to this item type, if available. If extra information is returned, it should be in the form of a complete sentence, minus the closing full stop. No information should be returned for obvious cases.- Specified by:
explainMismatchin interfaceItemType- Specified by:
explainMismatchin interfaceNodeTest- Overrides:
explainMismatchin classGNodeType- Parameters:
item- the item that doesn't match this typeth- the type hierarchy cache- Returns:
- optionally, a message explaining why the item does not match the type
-
getBasicAlphaCode
Get an alphabetic code representing the type, or at any rate, the nearest built-in type from which this type is derived. The codes are designed so that for any two built-in types A and B, alphaCode(A) is a prefix of alphaCode(B) if and only if A is a supertype of B.- Specified by:
getBasicAlphaCodein interfaceItemType- Returns:
- the alphacode for the nearest containing built-in type
-