de.tudarmstadt.ukp.jwktl.api.util
Interface IWiktionaryIterator<IterableType>

Type Parameters:
IterableType - the object type that is the subject of iteration.
All Superinterfaces:
Iterable<IterableType>, Iterator<IterableType>
All Known Implementing Classes:
BerkeleyDBWiktionaryIterator, HierarchicalWiktionaryIterator, WiktionaryIterator

public interface IWiktionaryIterator<IterableType>
extends Iterable<IterableType>, Iterator<IterableType>

A generic iterator that is used for Wiktionary data objects (i.e., IWiktionaryPage, IWiktionaryEntry, IWiktionarySense). The iterator supports both the usage as Iterator and as Iterable.

Caveat: the latter provides always the same instance, so use the WiktionaryIterator as an Iterable only once or fetch another WiktionaryIterator for other uses. This should save some memory and allow convenient usage in numerous situations. Besides, the implementation also allows to react on stopping the iteration, which is the case if (a) all items have been traversed, or (b) the user manually stops the iteration by invoking the close() method. Implementing the corresponding hotspot offers the possibility of closing a connection or freeing a resource after iteration. The iterator is read-only.

Author:
Christian M. Meyer

Method Summary
 void close()
          Stops the iteration.
 boolean isClosed()
          Returns true if the iterator has been closed, which is the case after close() has been called or after the last element has been retrieved using the Iterator.next() method.
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Method Detail

close

void close()
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.


isClosed

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



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