1 package net.sf.saxon.pattern; 2 3 import net.sf.saxon.om.Item; 4 import net.sf.saxon.om.NodeInfo; 5 import net.sf.saxon.type.AnyItemType; 6 import net.sf.saxon.type.ItemType; 7 import net.sf.saxon.type.Type; 8 import net.sf.saxon.tinytree.TinyTree; 9 10 16 17 public final class AnyNodeTest extends NodeTest { 18 19 static AnyNodeTest instance = new AnyNodeTest(); 20 21 24 25 public static AnyNodeTest getInstance() { 26 return instance; 27 } 28 29 34 35 public boolean matchesItem(Item item) { 36 return (item instanceof NodeInfo); 37 } 38 39 public ItemType getSuperType() { 40 return AnyItemType.getInstance(); 41 } 42 43 48 49 public final boolean matches(int nodeType, int fingerprint, int annotation) { 50 return nodeType != Type.PARENT_POINTER; 51 } 52 53 64 65 public boolean matches(TinyTree tree, int nodeNr) { 66 return tree.nodeKind[nodeNr] != Type.PARENT_POINTER; 67 } 68 69 75 76 public boolean matches(NodeInfo node) { 77 return true; 78 } 79 80 83 84 public final double getDefaultPriority() { 85 return -0.5; 86 } 87 88 92 93 public int getNodeKindMask() { 94 return 1<<Type.ELEMENT | 1<<Type.TEXT | 1<<Type.COMMENT | 1<<Type.PROCESSING_INSTRUCTION | 95 1<<Type.ATTRIBUTE | 1<<Type.NAMESPACE | 1<<Type.DOCUMENT; 96 } 97 98 public String toString() { 99 return "node()"; 100 } 101 102 105 106 public int hashCode() { 107 return "AnyNodeTest".hashCode(); 108 } 109 110 } 111 112 | Popular Tags |