1 package net.sf.saxon.pattern; 2 import net.sf.saxon.om.Item; 3 import net.sf.saxon.om.NamePool; 4 import net.sf.saxon.om.NodeInfo; 5 import net.sf.saxon.type.*; 6 import net.sf.saxon.tinytree.TinyTree; 7 8 import java.io.Serializable ; 9 import java.util.Set ; 10 11 23 24 public abstract class NodeTest implements ItemType, Serializable { 25 26 31 32 public boolean matchesItem(Item item) { 33 if (item instanceof NodeInfo) { 34 return matches((NodeInfo)item); 35 } else { 36 return false; 37 } 38 } 39 40 52 53 public ItemType getSuperType() { 54 return AnyNodeTest.getInstance(); 55 } 57 58 61 62 public abstract double getDefaultPriority(); 63 64 72 73 public ItemType getPrimitiveItemType() { 74 int p = getPrimitiveType(); 75 if (p == Type.NODE) { 76 return AnyNodeTest.getInstance(); 77 } else { 78 return NodeKindTest.makeNodeKindTest(p); 79 } 80 } 81 82 87 88 public int getPrimitiveType() { 89 return Type.NODE; 90 } 91 92 96 97 public int getFingerprint() { 98 return -1; 99 } 100 101 105 106 public AtomicType getAtomizedItemType() { 107 return Type.ANY_ATOMIC_TYPE; 109 } 110 111 122 123 public abstract boolean matches(TinyTree tree, int nodeNr); 124 125 140 141 public abstract boolean matches(int nodeKind, int fingerprint, int annotation); 142 143 149 150 public abstract boolean matches(NodeInfo node); 151 152 156 157 public abstract int getNodeKindMask(); 158 159 163 164 public SchemaType getContentType() { 165 return AnyType.getInstance(); 166 } 167 168 173 174 public Set getRequiredNodeNames() { 175 return null; 176 } 177 178 179 182 183 public String toString(NamePool pool) { 184 return toString(); 185 } 186 187 } 188 189 | Popular Tags |