KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > util > cursor > Batch


1 package org.sapia.util.cursor;
2
3 import java.util.Iterator JavaDoc;
4
5 /**
6  * This insterface specifies the behavior of batches of objects created by
7  * <code>Cursor</code> implementations.
8  *
9  * @see org.sapia.util.cursor.Cursor
10  *
11  * @author Yanick Duchesne
12  *
13  * <dl>
14  * <dt><b>Copyright: </b>
15  * <dd>Copyright &#169; 2002-2004 <a HREF="http://www.sapia-oss.org">Sapia Open
16  * Source Software </a>. All Rights Reserved.</dd>
17  * </dt>
18  * <dt><b>License: </b>
19  * <dd>Read the license.txt file of the jar or visit the <a
20  * HREF="http://www.sapia-oss.org/license.html">license page </a> at the Sapia
21  * OSS web site</dd>
22  * </dt>
23  * </dl>
24  */

25 public interface Batch {
26
27   /**
28    * @return the actual number of items that this instance holds.
29    */

30   public int getCount();
31
32   /**
33    * @param index
34    * an index that is relative to this batch (and not relative to the
35    * cursor to which this instance belongs).
36    *
37    * @return the <code>Object</code> at the specified index.
38    */

39   public Object JavaDoc getItemAt(int index);
40
41   /**
42    * @return the current position (relative to this instance's first item).
43    */

44   public int getPos();
45
46   /**
47    * @param pos
48    * this instance's current position.
49    */

50   public void setPos(int pos);
51
52   /**
53    * Sets the current position to the first item.
54    *
55    * @return this instance.
56    */

57   public Batch toFirst();
58
59   /**
60    * Sets the current position to the last item.
61    *
62    * @return this instance.
63    */

64   public Batch toLast();
65
66   /**
67    * @return the current absolute position (relative to this instance's cursor)
68    * of the "current" item in this instance.
69    */

70   public int getAbsolutePos();
71
72   /**
73    * @return an <code>Iterator</code> over this instance.
74    */

75   public Iterator JavaDoc getIterator();
76
77   /**
78    * Returns an iterator that will traverse this instance's elements in a
79    * "descending" fashion.
80    *
81    * @return an <code>Iterator</code> over this instance.
82    */

83   public Iterator JavaDoc getReverseIterator();
84
85   /**
86    * @return <code>true</code> if this instance has a "next" item pending.
87    */

88   public boolean hasNext();
89
90   /**
91    * @return the next item.
92    */

93   public Object JavaDoc next();
94
95   /**
96    * @return <code>true</code> if this instance has a "previous" item pending.
97    */

98   public boolean hasPrevious();
99
100   /**
101    * @return the previous item.
102    */

103   public Object JavaDoc previous();
104
105 }
106
Popular Tags