Package net.sf.saxon.pattern
Class PortableNamedXNodeType
java.lang.Object
net.sf.saxon.type.gnode.GNodeType
net.sf.saxon.type.gnode.XNodeType
net.sf.saxon.pattern.PortableNamedXNodeType
- All Implemented Interfaces:
NodePredicate,NodeTest,ItemType,ItemTypeWithSequenceTypeCache
PortableNamedXNodeType is variant of the NamedXNodeType class
that works across Configurations.
It is used in the function signatures of functions like fn:analyze-string;
these signatures appear in Java static data, so they cannot be tied to a particular
configuration.-
Constructor Summary
ConstructorsConstructorDescriptionPortableNamedXNodeType(int nodeKind, StructuredQName requiredName) Create a NameTest to match nodes by namePortableNamedXNodeType(int nodeKind, QNameTest qNameTest) Create a NameTest to match nodes by name -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines whether two NameTests are equalexplainMismatch(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 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 PatternintGet the node kind that this name test matchesintDetermine the types of nodes to which this pattern applies.getUType()Get the correspondingUType.inthashCode()Returns a hash code value for the object.booleanTest whether a given item conforms to this typetoString()Methods inherited from class net.sf.saxon.type.gnode.XNodeType
asXNodeTest, getCoercionPlan, getContentType, getGenre, getRequiredFingerprint, isNillableMethods inherited from class net.sf.saxon.type.gnode.GNodeType
getAtomizedItemType, getItemType, getPrimitiveItemType, getQNameTest, isAtomicType, isAtomizable, 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
-
Constructor Details
-
PortableNamedXNodeType
Create a NameTest to match nodes by name- Parameters:
nodeKind- the kind of node, for exampleType.ELEMENTqNameTest- a test that the name of the node must satisfy- Since:
- 13.0
-
PortableNamedXNodeType
Create a NameTest to match nodes by name- Parameters:
nodeKind- the kind of node, for exampleType.ELEMENTrequiredName- the required name of the nodes- Since:
- 13.0
-
-
Method Details
-
matches
Test whether a given item conforms to this type -
getAllowedNodeNames
Get the set of allowed node names that this type if capable of matching- Specified by:
getAllowedNodeNamesin classXNodeType- Returns:
- the allowed node names
-
getNodeKind
public int getNodeKind()Get the node kind that this name test matches- Returns:
- the matching node kind
-
getUType
Get the correspondingUType. A UType is a union of primitive item types. -
getDefaultPriority
public final double getDefaultPriority()Determine the default priority of this node test when used on its own as a Pattern- Returns:
- the default priority
-
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.- Returns:
- the alphacode for the nearest containing built-in type. For example: for xs:string return "AS", for xs:boolean "AB", for node() "N", for element() "NE", for map(*) "FM", for array(*) "FA".
-
getPrimitiveType
public int getPrimitiveType()Determine the types of nodes to which this pattern applies. Used for optimisation. For patterns that match nodes of several types, return Type.NODE- Specified by:
getPrimitiveTypein interfaceItemType- Overrides:
getPrimitiveTypein classGNodeType- Returns:
- the type of node matched by this pattern. e.g. Type.ELEMENT or Type.TEXT
-
toString
-
hashCode
public int hashCode()Returns a hash code value for the object. -
equals
Determines whether two NameTests are equal -
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
-