Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 package com.icl.saxon.tree; 2 import com.icl.saxon.om.NodeInfo; 3 import com.icl.saxon.om.AxisEnumeration; 4 import com.icl.saxon.pattern.NodeTest; 5 6 7 abstract class TreeEnumeration implements AxisEnumeration { 8 9 protected NodeImpl start; 10 protected NodeImpl next; 11 protected NodeTest nodeTest; 12 protected int last=-1; 13 14 18 19 public TreeEnumeration(NodeImpl origin, NodeTest nodeTest) { 20 next = origin; 21 start = origin; 22 this.nodeTest = nodeTest; 23 } 24 25 30 31 protected boolean conforms(NodeImpl node) { 32 if (node==null) return true; 33 return nodeTest.matches(node); 34 } 35 36 39 40 protected final void advance() { 41 do { 42 step(); 43 } while (!conforms(next)); 44 } 45 46 50 51 protected abstract void step(); 52 53 56 57 public final boolean hasMoreElements() { 58 return next!=null; 59 } 60 61 64 65 public final NodeInfo nextElement() { 66 NodeInfo n = next; 67 advance(); 68 return n; 69 } 70 71 74 75 public boolean isSorted() { 76 return false; } 78 79 82 83 public boolean isReverseSorted() { 84 return !isSorted(); 85 } 86 87 91 92 public boolean isPeer() { 93 return false; } 95 96 102 103 protected int count() { 104 int i=0; 105 while (hasMoreElements()) { 106 nextElement(); 107 i++; 108 } 109 return i; 110 } 111 } 112 113 114
| Popular Tags
|