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: // FIXME rename to add or writePosition?
21: public void consume(SeqPosition position);
22:
23: /** Consume a single position pair.
24: * This PositionConsumer may assume the sequence does no reference
25: * management; i.e. that copyPos is trivial and releasePos is
26: * a no-op. If that is not the case, use consume(TreePosition) instead.
27: */
28: public void writePosition(AbstractSequence seq, int ipos);
29:
30: }
|