01: // Copyright (c) 2001 Per M.A. Bothner and Brainfood Inc.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.lists;
05:
06: /**
07: * An object that can be "fed" a TreePosition, and will do something with it.
08: * That "something" can be printing it, copy it, filter it - or ignore it.
09: */
10:
11: public interface PositionConsumer
12: // FIXME rename to PositionList? Then what about TreePositionList
13: {
14: /**
15: * Consume node at current position.
16: *
17: * The caller may invalidate or change the position after consume returns,
18: * so if the consumer wants to save it, it needs to copy it.
19: *
20: * @return true if we are interested in more nodes.
21: */
22: // FIXME rename to add or writePosition?
23: public boolean consume(TreePosition position);
24:
25: /** Consume a single position triple.
26: * This PositionConsumer may assume the sequence does no reference
27: * management; i.e. that copyPosition is trivial and releasePosition is
28: * a no-op. If that is not the case, use consume(TreePosition) instead.
29: */
30: public boolean writePosition(AbstractSequence seq, int ipos,
31: Object xpos);
32:
33: }
|