1 package net.sf.saxon.pattern; 2 import net.sf.saxon.om.NodeInfo; 3 import net.sf.saxon.type.Type; 4 import net.sf.saxon.tinytree.TinyTree; 5 6 11 12 public final class AnyChildNodePattern extends NodeTest { 13 14 19 20 public boolean matches(int nodeKind, int fingerprint, int annotation) { 21 return (nodeKind == Type.ELEMENT || 22 nodeKind == Type.TEXT || 23 nodeKind == Type.COMMENT || 24 nodeKind == Type.PROCESSING_INSTRUCTION); 25 } 26 27 38 39 public boolean matches(TinyTree tree, int nodeNr) { 40 int nodeKind = tree.nodeKind[nodeNr]; 41 return (nodeKind == Type.ELEMENT || 42 nodeKind == Type.TEXT || 43 nodeKind == Type.COMMENT || 44 nodeKind == Type.PROCESSING_INSTRUCTION); 45 } 46 47 53 54 public boolean matches(NodeInfo node) { 55 int nodeKind = node.getNodeKind(); 56 return (nodeKind == Type.ELEMENT || 57 nodeKind == Type.TEXT || 58 nodeKind == Type.COMMENT || 59 nodeKind == Type.PROCESSING_INSTRUCTION); 60 } 61 62 66 67 public double getDefaultPriority() { 68 return -0.5; 69 } 70 71 75 76 public int getNodeKindMask() { 77 return 1<<Type.ELEMENT | 1<<Type.TEXT | 1<<Type.COMMENT | 1<<Type.PROCESSING_INSTRUCTION; 78 } 79 80 public String toString() { 81 return "node()"; 82 } 83 84 87 88 public int hashCode() { 89 return "AnyChildNodePattern".hashCode(); 90 } 91 92 } 93 94 | Popular Tags |