1 4 package gnu.kawa.xml; 5 import gnu.lists.*; 6 7 8 9 public class AncestorOrSelfAxis extends TreeScanner 10 { 11 public static AncestorOrSelfAxis make (NodePredicate type) 12 { 13 AncestorOrSelfAxis axis = new AncestorOrSelfAxis(); 14 axis.type = type; 15 return axis; 16 } 17 18 private static void scan (AbstractSequence seq, int ipos, int end, 19 NodePredicate type, PositionConsumer out) 20 { 21 if (ipos != end) 22 { 23 scan(seq, seq.parentPos(ipos), end, type, out); 24 if (type.isInstancePos(seq, ipos)) 25 out.writePosition(seq, ipos); 26 } 27 } 28 29 public void scan (AbstractSequence seq, int ipos, PositionConsumer out) 30 { 31 int end = seq.endPos(); 32 scan(seq, ipos, end, type, out); 33 } 34 } 35 | Popular Tags |