1 package com.icl.saxon.pattern; 2 import com.icl.saxon.om.NodeInfo; 3 import com.icl.saxon.om.NamePool; 4 import com.icl.saxon.expr.XPathException; 5 6 12 13 public final class NamespaceTest extends NodeTest { 14 15 private NamePool namePool; 16 private short type; 17 private short uriCode; 18 19 public NamespaceTest(NamePool pool, short nodeType, short uriCode) { 20 namePool = pool; 21 type = nodeType; 22 this.uriCode = uriCode; 23 } 24 25 28 29 public final boolean matches(NodeInfo node) { 30 int fingerprint = node.getFingerprint(); 31 if (fingerprint == -1) return false; 32 return type == node.getNodeType() && 33 uriCode == namePool.getURICode(fingerprint); 34 } 35 36 41 42 public boolean matches(short nodeType, int fingerprint) { 43 if (fingerprint == -1) return false; 44 if (nodeType != type) return false; 45 return uriCode == namePool.getURICode(fingerprint); 46 } 47 48 51 52 public final double getDefaultPriority() { 53 return -0.25; 54 } 55 56 61 62 public short getNodeType() { 63 return type; 64 } 65 66 67 } 68 69 | Popular Tags |