KickJava   Java API By Example, From Geeks To Geeks.

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


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 following-sibling:: step in a path expression. */
8
9 public class FollowingSiblingAxis extends TreeScanner
10 {
11   public static FollowingSiblingAxis make (NodePredicate type)
12   {
13     FollowingSiblingAxis axis = new FollowingSiblingAxis();
14     axis.type = type;
15     return axis;
16   }
17
18   public void scan (AbstractSequence seq, int ipos, PositionConsumer out)
19   {
20     int limit = seq.endPos();
21     for (;;)
22       {
23     ipos = seq.nextMatching(ipos, type, limit, false);
24     if (ipos == 0)
25       break;
26     out.writePosition(seq, ipos);
27       }
28   }
29 }
30
Popular Tags