private NodeKindTest(int nodeKind) { kind = nodeKind; uType = UType.fromTypeCode(nodeKind); }
public LocalNameTest(NamePool pool, int nodeKind, String localName) { this.namePool = pool; this.nodeKind = nodeKind; this.localName = localName; uType = UType.fromTypeCode(nodeKind); }
public NamespaceTest(NamePool pool, int nodeKind, String uri) { namePool = pool; this.nodeKind = nodeKind; this.uri = uri; this.uType = UType.fromTypeCode(nodeKind); }
public LocalNameTest(NamePool pool, int nodeKind, String localName) { this.namePool = pool; this.nodeKind = nodeKind; this.localName = localName; uType = UType.fromTypeCode(nodeKind); }
public NamespaceTest(NamePool pool, int nodeKind, String uri) { namePool = pool; this.nodeKind = nodeKind; this.uri = uri; this.uType = UType.fromTypeCode(nodeKind); }
/** * Create a NameTest to match nodes by their nameCode allocated from the NamePool * * @param nodeKind the kind of node, for example {@link Type#ELEMENT} * @param nameCode the nameCode representing the name of the node * @param namePool the namePool holding the name codes * @since 8.4 */ public NameTest(int nodeKind, int nameCode, NamePool namePool) { this.nodeKind = nodeKind; this.fingerprint = nameCode & NamePool.FP_MASK; this.namePool = namePool; this.uType = UType.fromTypeCode(nodeKind); }
private NodeKindTest(int nodeKind) { kind = nodeKind; uType = UType.fromTypeCode(nodeKind); }
/** * Create a NameTest to match nodes by their nameCode allocated from the NamePool * * @param nodeKind the kind of node, for example {@link Type#ELEMENT} * @param nameCode the nameCode representing the name of the node * @param namePool the namePool holding the name codes * @since 8.4 */ public NameTest(int nodeKind, int nameCode, NamePool namePool) { this.nodeKind = nodeKind; this.fingerprint = nameCode & NamePool.FP_MASK; this.namePool = namePool; this.uType = UType.fromTypeCode(nodeKind); }
/** * Get the static type of the expression as a UType, following precisely the type * inference rules defined in the XSLT 3.0 specification. * * @return the static item type of the expression according to the XSLT 3.0 defined rules * @param contextItemType the type of the context item */ @Override public UType getStaticUType(UType contextItemType) { return UType.fromTypeCode(requiredItemType.getPrimitiveType()); }
/** * Get the corresponding {@link net.sf.saxon.type.UType}. A UType is a union of primitive item * types. * * @return the smallest UType that subsumes this item type */ public UType getUType() { return UType.fromTypeCode(origin.getNodeKind()); }
/** * Get the corresponding {@link net.sf.saxon.type.UType}. A UType is a union of primitive item * types. * * @return the smallest UType that subsumes this item type */ public UType getUType() { return UType.fromTypeCode(origin.getNodeKind()); }
/** * Get the static type of the expression as a UType, following precisely the type * inference rules defined in the XSLT 3.0 specification. * * @return the static item type of the expression according to the XSLT 3.0 defined rules * @param contextItemType the type of the context item */ @Override public UType getStaticUType(UType contextItemType) { return UType.fromTypeCode(requiredItemType.getPrimitiveType()); }
/** * Create a NameTest to match nodes by name * * @param nodeKind the kind of node, for example {@link Type#ELEMENT} * @param uri the namespace URI of the required nodes. Supply "" to match nodes that are in * no namespace * @param localName the local name of the required nodes. Supply "" to match unnamed nodes * @param namePool the namePool holding the name codes * @since 9.0 */ public NameTest(int nodeKind, String uri, String localName, NamePool namePool) { this.uri = uri; this.localName = localName; this.nodeKind = nodeKind; this.fingerprint = namePool.allocateFingerprint(uri, localName) & NamePool.FP_MASK; this.namePool = namePool; this.uType = UType.fromTypeCode(nodeKind); }
/** * Create a NameTest to match nodes by name * * @param nodeKind the kind of node, for example {@link Type#ELEMENT} * @param uri the namespace URI of the required nodes. Supply "" to match nodes that are in * no namespace * @param localName the local name of the required nodes. Supply "" to match unnamed nodes * @param namePool the namePool holding the name codes * @since 9.0 */ public NameTest(int nodeKind, String uri, String localName, NamePool namePool) { this.uri = uri; this.localName = localName; this.nodeKind = nodeKind; this.fingerprint = namePool.allocateFingerprint(uri, localName) & NamePool.FP_MASK; this.namePool = namePool; this.uType = UType.fromTypeCode(nodeKind); }
/** * Get the UType of an Item * @param item the item whose UType is required * @return the UType of the item */ public static UType getUType(Item item) { if (item instanceof NodeInfo) { return fromTypeCode(((NodeInfo) item).getNodeKind()); } else if (item instanceof AtomicValue) { return ((AtomicValue)item).getUType(); } else if (item instanceof Function) { return UType.FUNCTION; } else if (item instanceof ObjectValue) { return UType.EXTENSION; } else { return UType.VOID; } }
/** * Get the UType of an Item * @param item the item whose UType is required * @return the UType of the item */ public static UType getUType(Item item) { if (item instanceof NodeInfo) { return fromTypeCode(((NodeInfo) item).getNodeKind()); } else if (item instanceof AtomicValue) { return ((AtomicValue)item).getUType(); } else if (item instanceof Function) { return UType.FUNCTION; } else if (item instanceof ObjectValue) { return UType.EXTENSION; } else { return UType.VOID; } }
/** * Create a NameTest to match nodes by name * * @param nodeKind the kind of node, for example {@link Type#ELEMENT} * @param name the name of the nodes that this NameTest will match * @param pool the namePool holding the name codes * @since 9.4 */ public NameTest(int nodeKind, NodeName name, NamePool pool) { this.uri = name.getURI(); this.localName = name.getLocalPart(); this.nodeKind = nodeKind; this.fingerprint = name.obtainFingerprint(pool); this.namePool = pool; this.uType = UType.fromTypeCode(nodeKind); }
/** * Create a NameTest to match nodes by name * * @param nodeKind the kind of node, for example {@link Type#ELEMENT} * @param name the name of the nodes that this NameTest will match * @param pool the namePool holding the name codes * @since 9.4 */ public NameTest(int nodeKind, NodeName name, NamePool pool) { this.uri = name.getURI(); this.localName = name.getLocalPart(); this.nodeKind = nodeKind; this.fingerprint = name.obtainFingerprint(pool); this.namePool = pool; this.uType = UType.fromTypeCode(nodeKind); }
/** * Internal factory method to create a BuiltInAtomicType. There is one instance for each of the * built-in atomic types * * @param fingerprint The name of the type * @param baseType The base type from which this type is derived * @param code Alphabetic code chosen to enable ordering of types according to the type hierarchy * @param ordered true if the type is ordered * @return the newly constructed built in atomic type */ /*@NotNull*/ private static BuiltInAtomicType makeAtomicType(int fingerprint, SimpleType baseType, String code, boolean ordered) { BuiltInAtomicType t = new BuiltInAtomicType(fingerprint); t.setBaseTypeFingerprint(baseType.getFingerprint()); if (t.isPrimitiveType()) { t.primitiveFingerprint = fingerprint; } else { t.primitiveFingerprint = ((AtomicType) baseType).getPrimitiveType(); } t.uType = UType.fromTypeCode(t.primitiveFingerprint); t.ordered = ordered; t.alphaCode = code; BuiltInType.register(fingerprint, t); return t; }
/** * Internal factory method to create a BuiltInAtomicType. There is one instance for each of the * built-in atomic types * * @param fingerprint The name of the type * @param baseType The base type from which this type is derived * @param ordered true if the type is ordered * @return the newly constructed built in atomic type */ /*@NotNull*/ private static BuiltInAtomicType makeAtomicType(int fingerprint, SimpleType baseType, boolean ordered) { BuiltInAtomicType t = new BuiltInAtomicType(fingerprint); t.setBaseTypeFingerprint(baseType.getFingerprint()); if (t.isPrimitiveType()) { t.primitiveFingerprint = fingerprint; } else { t.primitiveFingerprint = ((AtomicType) baseType).getPrimitiveType(); } t.uType = UType.fromTypeCode(t.primitiveFingerprint); t.ordered = ordered; BuiltInType.register(fingerprint, t); return t; }