1 package com.icl.saxon.tree; 2 import com.icl.saxon.pattern.NodeTest; 3 4 final class DescendantEnumeration extends TreeEnumeration { 5 6 private NodeImpl root; 7 private boolean includeSelf; 8 9 public DescendantEnumeration(NodeImpl node, NodeTest nodeTest, boolean includeSelf) { 10 super(node, nodeTest); 11 root = node; 12 this.includeSelf = includeSelf; 13 if (!includeSelf || !conforms(node)) { 14 advance(); 15 } 16 } 17 18 public boolean isSorted() { 19 return true; 20 } 21 22 protected void step() { 23 next = next.getNextInDocument(root); 24 } 25 26 29 30 public int getLastPosition() { 31 if (last>=0) return last; 32 DescendantEnumeration enum = 33 new DescendantEnumeration(start, nodeTest, includeSelf); 34 return enum.count(); 35 } 36 } 37 38 | Popular Tags |