KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > kawa > xml > ParentAxis


1 // Copyright (c) 2003 Per M.A. Bothner.
2
// This is free software; for terms and warranty disclaimer see ./COPYING.
3

4 package gnu.kawa.xml;
5 import gnu.lists.*;
6
7 /** Used to implement a parent:: step in a path expression. */
8
9 public class ParentAxis extends TreeScanner
10 {
11   public static ParentAxis make (NodePredicate type)
12   {
13     ParentAxis axis = new ParentAxis();
14     axis.type = type;
15     return axis;
16   }
17
18   public void scan (AbstractSequence seq, int ipos, PositionConsumer out)
19   {
20     ipos = seq.parentPos(ipos);
21     int end = seq.endPos();
22     if (ipos != end && type.isInstancePos(seq, ipos))
23       out.writePosition(seq, ipos);
24   }
25 }
26
Popular Tags