1 package net.sf.saxon.tree; 2 import net.sf.saxon.om.SequenceIterator; 3 import net.sf.saxon.pattern.NodeTest; 4 5 final class PrecedingEnumeration extends TreeEnumeration { 6 7 NodeImpl nextAncestor; 8 9 public PrecedingEnumeration(NodeImpl node, NodeTest nodeTest) { 10 super(node, nodeTest); 11 12 nextAncestor = (NodeImpl)node.getParent(); 14 advance(); 15 } 16 17 18 21 22 protected boolean conforms(NodeImpl node) { 23 if (node!=null) { 26 if (node.isSameNodeInfo(nextAncestor)) { 27 nextAncestor = (NodeImpl)nextAncestor.getParent(); 28 return false; 29 } 30 } 31 return super.conforms(node); 32 } 33 34 protected void step() { 35 next = next.getPreviousInDocument(); 36 } 37 38 41 42 public SequenceIterator getAnother() { 43 return new PrecedingEnumeration(start, nodeTest); 44 } 45 46 } 47 48 49 50 51 | Popular Tags |