gr.uoa.di.madgik.grs.reader
Class RandomReaderIterator<T extends Record>

java.lang.Object
  extended by gr.uoa.di.madgik.grs.reader.RandomReaderIterator<T>
Type Parameters:
T - The type of Records as defined in the respective RandomReader
All Implemented Interfaces:
java.util.Iterator<T>, java.util.ListIterator<T>

public class RandomReaderIterator<T extends Record>
extends java.lang.Object
implements java.util.ListIterator<T>

A list iterator implementing class that can be used to iterate over the Records accessible through a RandomReader instance

Author:
gpapanikos

Method Summary
 void add(T o)
          
 boolean hasNext()
          
 boolean hasPrevious()
          
 T next()
          
 int nextIndex()
          
 T previous()
          
 int previousIndex()
          
 void remove()
          
 void set(T o)
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasNext

public boolean hasNext()

If the status of the reader indicates that there may be more Records available but have not yet reached the current reader through the respective mirroring procedure, then the ForwardReader.waitAvailable(long, java.util.concurrent.TimeUnit) is used with the timeout values defined by RandomReader.getIteratorTimeout() and RandomReader.getIteratorTimeUnit()

Specified by:
hasNext in interface java.util.Iterator<T extends Record>
Specified by:
hasNext in interface java.util.ListIterator<T extends Record>
See Also:
Iterator.hasNext()

next

public T next()

the RandomReader.get(long, java.util.concurrent.TimeUnit) method is used to retrieve the next available Record. The timeout values used are the ones defined by RandomReader.getIteratorTimeout() and RandomReader.getIteratorTimeUnit(). in case there is some error during the Record retrieval or the timeout expired, null is returned

Specified by:
next in interface java.util.Iterator<T extends Record>
Specified by:
next in interface java.util.ListIterator<T extends Record>
See Also:
Iterator.next()

hasPrevious

public boolean hasPrevious()

If the status of the reader indicates that there are previous Records true is returned. Otherwise false

Specified by:
hasPrevious in interface java.util.ListIterator<T extends Record>
See Also:
Iterator.hasNext()

previous

public T previous()

The RandomReader.seek(long) method is used to move back the necessary number of records so that the next call to RandomReader.get() will return the previous record. If some error occurs during the record retrieval, null is returned

Specified by:
previous in interface java.util.ListIterator<T extends Record>
See Also:
ListIterator.previous()

nextIndex

public int nextIndex()

Operation is not supported. An IllegalStateException is thrown upon invocation

Specified by:
nextIndex in interface java.util.ListIterator<T extends Record>
See Also:
ListIterator.nextIndex()

previousIndex

public int previousIndex()

Operation is not supported. An IllegalStateException is thrown upon invocation

Specified by:
previousIndex in interface java.util.ListIterator<T extends Record>
See Also:
ListIterator.previousIndex()

remove

public void remove()

Operation is not supported. An IllegalStateException is thrown upon invocation

Specified by:
remove in interface java.util.Iterator<T extends Record>
Specified by:
remove in interface java.util.ListIterator<T extends Record>
See Also:
ListIterator.remove()

set

public void set(T o)

Operation is not supported. An IllegalStateException is thrown upon invocation

Specified by:
set in interface java.util.ListIterator<T extends Record>
See Also:
ListIterator.set(java.lang.Object)

add

public void add(T o)

Operation is not supported. An IllegalStateException is thrown upon invocation

Specified by:
add in interface java.util.ListIterator<T extends Record>
See Also:
ListIterator.add(java.lang.Object)