KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > lists > PositionConsumer


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

4 package gnu.lists;
5
6 /**
7  * An object that can be "fed" a TreePosition, and will do something with it.
8  * That "something" can be printing it, copy it, filter it - or ignore it.
9  */

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 }
31
Popular Tags