de.tudarmstadt.ukp.jwktl.api.util
Class WiktionaryIterator<Type>

java.lang.Object
  extended by de.tudarmstadt.ukp.jwktl.api.util.WiktionaryIterator<Type>
All Implemented Interfaces:
IWiktionaryIterator<Type>, Iterable<Type>, Iterator<Type>
Direct Known Subclasses:
BerkeleyDBWiktionaryIterator, HierarchicalWiktionaryIterator

public abstract class WiktionaryIterator<Type>
extends Object
implements IWiktionaryIterator<Type>

Default implementation of the IWiktionaryIterator interface.

Author:
Christian M. Meyer

Field Summary
protected  boolean closed
           
protected  Type nextValue
           
 
Constructor Summary
WiktionaryIterator()
           
 
Method Summary
 void close()
          Stops the iteration.
protected abstract  void doClose()
          Hotspot that is invoked after closing the iteration, i.e. either all items are traversed or manual termination.
protected abstract  Type fetchNext()
          Hotspot for fetching the next element for iteration.
 boolean hasNext()
           
 boolean isClosed()
          Returns true if the iterator has been closed, which is the case after IWiktionaryIterator.close() has been called or after the last element has been retrieved using the Iterator.next() method.
 Iterator<Type> iterator()
           
 Type next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextValue

protected Type nextValue

closed

protected boolean closed
Constructor Detail

WiktionaryIterator

public WiktionaryIterator()
Method Detail

iterator

public Iterator<Type> iterator()
Specified by:
iterator in interface Iterable<Type>

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<Type>

next

public Type next()
Specified by:
next in interface Iterator<Type>

fetchNext

protected abstract Type fetchNext()
Hotspot for fetching the next element for iteration. If there are no elements left, null is to be returned, which causes the iterator to return false for the next hasNext().


doClose

protected abstract void doClose()
Hotspot that is invoked after closing the iteration, i.e. either all items are traversed or manual termination. The hotspot is called only once.


remove

public void remove()
Specified by:
remove in interface Iterator<Type>

close

public void close()
Description copied from interface: IWiktionaryIterator
Stops the iteration. This method is automatically called after all items are traversed, but needs to be called manually if the iteration is stopped before. Closing the iterator is necessary to guarantee data consistency and proper resource management. Closing an iterator multiple times has no effect. After an iterator is closed, Iterator.hasNext() will always result in false.

Specified by:
close in interface IWiktionaryIterator<Type>

isClosed

public boolean isClosed()
Description copied from interface: IWiktionaryIterator
Returns true if the iterator has been closed, which is the case after IWiktionaryIterator.close() has been called or after the last element has been retrieved using the Iterator.next() method.

Specified by:
isClosed in interface IWiktionaryIterator<Type>


Copyright © 2011-2013 Ubiquitous Knowledge Processing (UKP) Lab. All Rights Reserved.