org.sadun.util
Interface IdIterator

All Known Implementing Classes:
SqlIdIterator

public interface IdIterator

Author:
Cristiano Sadun

Field Summary
static int BACKWARD
          The constant for "backwards" direction.
static int FORWARD
          The constant for the "forwards" direction.
 
Method Summary
 void close()
          Disposes of any resource that may be in use by the iterator.
 java.lang.String getCurrentId()
          Return the id on which the iterator is currently positioned.
 java.lang.String getNextId(int direction)
          Moves the current id to the next in the given direction and returns it.
 boolean hasNext(int direction)
          Return true if there exist an id in the given direction.
 

Field Detail

FORWARD

public static final int FORWARD
The constant for the "forwards" direction. Its value is 0.

See Also:
Constant Field Values

BACKWARD

public static final int BACKWARD
The constant for "backwards" direction. Its value is 1.

See Also:
Constant Field Values
Method Detail

hasNext

public boolean hasNext(int direction)
Return true if there exist an id in the given direction.

Parameters:
direction - one of FORWARD or BACKWARD constants.
Returns:
true if there exist an id in the given direction.

getCurrentId

public java.lang.String getCurrentId()
Return the id on which the iterator is currently positioned.

Returns:
the id on which the iterator is currently positioned.

getNextId

public java.lang.String getNextId(int direction)
Moves the current id to the next in the given direction and returns it.

Parameters:
direction - one of FORWARD or BACKWARD constants.
Returns:
the next id in the given direction.

close

public void close()
Disposes of any resource that may be in use by the iterator.