com.softwareag.tamino.db.api.objectModel
Interface TNonXMLObjectIterator

All Known Implementing Classes:
TNonXMLObjectIteratorImpl, TNonXMLObjectIteratorTimeLoggingImpl

public interface TNonXMLObjectIterator

TNonXMLObjectIterator is a bidirectional iterator to iterate over a list of TNonXMLObject instances. It�s behaviour is similar to the java.util.ListIterator. The methods of the iterator may throw two different kind of exceptions. If there are problems accessing Tamino the TIteratorException is thrown. If the iterator moves beyond the boundaries of the result set the TNoSuchNonXMLObjectException is thrown. Note that two TNonXMLObject instances representing the same Tamino document retrieved via an iterator may not necessarily be identical Java objects. You should therefore not use the Java comparator "==" to decide whether two TNonXMLObject instances represent the same Tamino document.

Alternating calls to next and previous will return the same TNonXMLObject instance repeatedly. If you call moveBy with a positive argument n, it has the same effect on the position of the iterator as calling next n times. If you call moveBy with a negative argument n, it has the same effect on the iterator as calling previous n times. Calling moveBy with a zero argument has no effect.

Version:
$Revision: 1.12 $
Author:
Marcus Schreyer

Method Summary
 boolean canMoveBy(int offset)
          Indicates if this iterator can be moved by the given offset.
 void close()
          Closes this iterator.
 boolean hasNext()
          Returns true if this iterator has more TNonXMLObject instances when traversing the list in the forward direction.
 boolean hasPrevious()
          Returns true if this list iterator has more TNonXMLObject instances when traversing the list in the reverse direction.
 void moveBy(int offset)
          Moves the iterator by the given offset.
 TNonXMLObject next()
          Returns the next element in the list of TNonXMLObject instances.
 TNonXMLObject previous()
          Returns the previous TNonXMLObject instance in the list.
 void reset()
          Resets the iterator to its initial state.
 

Method Detail

hasNext

boolean hasNext()
Returns true if this iterator has more TNonXMLObject instances when traversing the list in the forward direction. (In other words, returns true if next would return a TNonXMLObject instance rather than throwing an exception.)

Returns:
true if the list iterator has more TNonXMLObject instances when traversing the list in the forward direction.

next

TNonXMLObject next()
                   throws TNoSuchNonXMLObjectException,
                          TIteratorException
Returns the next element in the list of TNonXMLObject instances. This method may be called repeatedly to iterate through the list, or intermixed with calls to previous to go back and forth. (Note that alternating calls to next and previous will return the same TNonXMLObject instance repeatedly.)

Returns:
the next TNonXMLObject instance in the list.
Throws:
TNoSuchNonXMLObjectException - the if iteration has no next TNonXMLObject instance.
TIteratorException - signals an error while attempting to access Tamino.

hasPrevious

boolean hasPrevious()
Returns true if this list iterator has more TNonXMLObject instances when traversing the list in the reverse direction. (In other words, returns true if previous would return a TNonXMLObject instance rather than throwing an exception.)

Returns:
true if the list iterator has more TNonXMLObject instances when traversing the list in the reverse direction.

previous

TNonXMLObject previous()
                       throws TNoSuchNonXMLObjectException,
                              TIteratorException
Returns the previous TNonXMLObject instance in the list. This method may be called repeatedly to iterate through the list backwards, or intermixed with calls to next to go back and forth. (Note that alternating calls to previous and next will return the same TNonXMLObject instance repeatedly.)

Returns:
The previous TNonXMLObject instance in the list.
Throws:
TNoSuchNonXMLObjectException - if the iteration has no previous TNonXMLObject instance.
TIteratorException - signals an error while attempting to access Tamino.

canMoveBy

boolean canMoveBy(int offset)
                  throws TIteratorException
Indicates if this iterator can be moved by the given offset.

Parameters:
offset - the positive or negative amount to move the iterator
Returns:
true if move is possible, false otherwise.
Throws:
TIteratorException - signals an error while attempting to access Tamino.

moveBy

void moveBy(int offset)
            throws TNoSuchNonXMLObjectException,
                   TIteratorException
Moves the iterator by the given offset. If you call moveBy with a positive argument n, it has the same effect on the position of the iterator as calling next n times. If you call moveBy with a negative argument n, it has the same effect on the iterator as calling previous n times. Calling moveBy with a zero argument has no effect.

Parameters:
offset - the positive or negative amount to move the iterator
Throws:
TNoSuchNonXMLObjectException - if the new position is out of bounds.
TIteratorException - signals an error while attempting to access Tamino.

reset

void reset()
           throws TIteratorException
Resets the iterator to its initial state. The iterator is moved back to point before the first TNonXMLObject instance in the list.

Throws:
TIteratorException - signals an error while attempting to access Tamino.

close

void close()
           throws TIteratorException
Closes this iterator. Closing the iterator releases all resources held by the iterator. After closing an iterator it is no longer usable.

Throws:
TIteratorExceptionsignals - an error while attempting to access Tamino.
TIteratorException


Copyright (c) 2013 Software AG. All Rights Reserved.