01: // Copyright (c) 2003 Per M.A. Bothner.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.kawa.xml;
05:
06: import gnu.lists.*;
07:
08: /** Used to implement a following-sibling:: step in a path expression. */
09:
10: public class FollowingSiblingAxis extends TreeScanner {
11: public static FollowingSiblingAxis make(NodePredicate type) {
12: FollowingSiblingAxis axis = new FollowingSiblingAxis();
13: axis.type = type;
14: return axis;
15: }
16:
17: public void scan(AbstractSequence seq, int ipos,
18: PositionConsumer out) {
19: int limit = seq.endPos();
20: for (;;) {
21: ipos = seq.nextMatching(ipos, type, limit, false);
22: if (ipos == 0)
23: break;
24: out.writePosition(seq, ipos);
25: }
26: }
27: }
|