com.softwareag.tamino.db.api.response
Class TNonXMLObjectIteratorImpl

java.lang.Object
  extended by com.softwareag.tamino.db.api.response.TNonXMLObjectIteratorImpl
All Implemented Interfaces:
TNonXMLObjectIterator
Direct Known Subclasses:
TNonXMLObjectIteratorTimeLoggingImpl

public class TNonXMLObjectIteratorImpl
extends java.lang.Object
implements TNonXMLObjectIterator

TNonXMLObjectIteratorImpl is the implementation class for TNonXMLObjectIterator. TNonXMLObjectIteratorImpl sits on top of a TXMLObjectIterator and can currently be used for unidirectional forward iterations only. Please note that the Non-XML object instances are obtained in a lazy manner and indirectly by an iteration over XML object instances. This means here for each Non-XML object exists an XML object representation thus the TXMLObjectIterator serves as an indirection to a TNonXMLObjectIterator.

Version:
$Revision: 1.24 $
Author:
Marcus Schreyer

Constructor Summary
TNonXMLObjectIteratorImpl()
          Initializes the default (empty) TNonXMLObjectIteratorImpl.
TNonXMLObjectIteratorImpl(TXMLObjectIterator xmlObjectIterator, TAbstractAccessor abstractAccessor)
          Initializes the TNonXMLObjectIteratorImpl with the given TXMLObjectIterator and the given TInvocation instance.
 
Method Summary
 boolean canMoveBy(int offset)
          Indicates if this iterator can be moved by the given offset.
 void close()
          Invalidate this iterator.
 boolean hasNext()
          Indicates if iterator has a next TNonXMLObject instance.
 boolean hasPrevious()
          Indicates if this iterator has a previous TNonXMLObject instance.
 void moveBy(int offset)
          Moves the iterator by the given offset.
 TNonXMLObject next()
          Returns the next TNonXMLObject in the underlying sequence.
 TNonXMLObject previous()
          Returns the previous TXMLObject in the list.
 void reset()
          Resets the iterator to its initial state as it has been constructed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TNonXMLObjectIteratorImpl

public TNonXMLObjectIteratorImpl()
Initializes the default (empty) TNonXMLObjectIteratorImpl.


TNonXMLObjectIteratorImpl

public TNonXMLObjectIteratorImpl(TXMLObjectIterator xmlObjectIterator,
                                 TAbstractAccessor abstractAccessor)
Initializes the TNonXMLObjectIteratorImpl with the given TXMLObjectIterator and the given TInvocation instance.

Parameters:
xmlObjectIterator - referrs as an iterator to the Non-XML objects XML object representation.
invocation - is needed here to invoke for each TXMLObject its concrete TNonXMLObject representation.
Method Detail

hasNext

public boolean hasNext()
Indicates if iterator has a next TNonXMLObject instance.

Specified by:
hasNext in interface TNonXMLObjectIterator
Returns:
true if next element is given, false otherwise.

next

public TNonXMLObject next()
                   throws TNoSuchNonXMLObjectException,
                          TIteratorException
Returns the next TNonXMLObject in the underlying sequence. 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 element repeatedly.)

Specified by:
next in interface TNonXMLObjectIterator
Returns:
The next TNonXMLObject.
Throws:
TNoSuchNonXMLObjectException - if iteration has no more TNonXMLObject instances.
TIteratorException - if iteration failed because of an underlying Tamino problem.

hasPrevious

public boolean hasPrevious()
Indicates if this iterator has a previous TNonXMLObject instance.

Specified by:
hasPrevious in interface TNonXMLObjectIterator
Returns:
true if previous TXMLObject is given, false otherwise.

previous

public TNonXMLObject previous()
                       throws TNoSuchNonXMLObjectException,
                              TIteratorException
Returns the previous TXMLObject in the list. This method may be called repeatedly to iterate through the list of given TXMLObject instances.

Specified by:
previous in interface TNonXMLObjectIterator
Returns:
The previous TXMLObject.
Throws:
java.util.NoSuchElementException - if iteration has no more elements.
TIteratorException - if iteration failed because of an underlying Tamino problem.
TNoSuchNonXMLObjectException - if the iteration has no previous TNonXMLObject instance.

canMoveBy

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

Specified by:
canMoveBy in interface TNonXMLObjectIterator
Parameters:
offset - the positive or negative amount to move the iterator
Returns:
true if move is possible, false otherwise.
Throws:
TIteratorException - if iteration failed because of an underlying Tamino problem.

moveBy

public void moveBy(int offset)
            throws TNoSuchNonXMLObjectException,
                   TIteratorException
Moves the iterator by the given offset.

Specified by:
moveBy in interface TNonXMLObjectIterator
Parameters:
offset - the positive or negative amount to move the iterator
Throws:
TNoSuchNonXMLObjectException - if the new position is out of bounds.
TIteratorException - if iteration failed because of an underlying Tamino problem.

reset

public void reset()
           throws TIteratorException
Resets the iterator to its initial state as it has been constructed.

Specified by:
reset in interface TNonXMLObjectIterator
Throws:
TIteratorException - if iteration failed because of an underlying Tamino problem.

close

public void close()
           throws TIteratorException
Invalidate this iterator. Closing the iterator releases any resources which a iterator may hold. After closing a iterator it is no longer usable.

Specified by:
close in interface TNonXMLObjectIterator
Throws:
TIteratorException - if iteration failed because of an underlying Tamino problem.


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