de.tudarmstadt.ukp.jwktl.api.entry
Class BerkeleyDBWiktionaryIterator<OutputType,InputType extends OutputType>
java.lang.Object
de.tudarmstadt.ukp.jwktl.api.util.WiktionaryIterator<OutputType>
de.tudarmstadt.ukp.jwktl.api.entry.BerkeleyDBWiktionaryIterator<OutputType,InputType>
- Type Parameters:
OutputType
- the class type that is returned for each
fetched element.InputType
- the class type the stored entities have. It
is necessary that the input type is the same or a subclass
of the type specified as output.
- All Implemented Interfaces:
- IWiktionaryIterator<OutputType>, Iterable<OutputType>, Iterator<OutputType>
public class BerkeleyDBWiktionaryIterator<OutputType,InputType extends OutputType>
- extends WiktionaryIterator<OutputType>
Implementation of the WiktionaryIterator
for the use of a
Berkeley DB EntityCursor
as a source of elements. The cursor
is passed to the constructor and automatically closed upon manually
termination of the iteration or after all elements have been traversed.
Additionally, a hotspot is provided to react on the return of an
element of the cursor to, e.g., initialize the entity. It is
possible to convert the stored entity to a more general type
using different type parameters.
Method Summary |
protected void |
doClose()
Hotspot that is invoked after closing the iteration, i.e. either all
items are traversed or manual termination. |
protected OutputType |
fetchNext()
Hotspot for fetching the next element for iteration. |
protected OutputType |
loadEntity(InputType entity)
Hotspot that is invoked when returning an entity. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
edition
protected BerkeleyDBWiktionaryEdition edition
cursor
protected com.sleepycat.persist.EntityCursor<InputType extends OutputType> cursor
BerkeleyDBWiktionaryIterator
public BerkeleyDBWiktionaryIterator(BerkeleyDBWiktionaryEdition edition,
com.sleepycat.persist.EntityCursor<InputType> cursor)
- Initializes the iterator for the specified cursor.
fetchNext
protected OutputType fetchNext()
- Description copied from class:
WiktionaryIterator
- 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 WiktionaryIterator.hasNext()
.
- Specified by:
fetchNext
in class WiktionaryIterator<OutputType>
loadEntity
protected OutputType loadEntity(InputType entity)
- Hotspot that is invoked when returning an entity. It can, e.g.,
be used to initialize the entity before usage.
doClose
protected void doClose()
- Description copied from class:
WiktionaryIterator
- Hotspot that is invoked after closing the iteration, i.e. either all
items are traversed or manual termination. The hotspot is called only
once.
- Specified by:
doClose
in class WiktionaryIterator<OutputType>
Copyright © 2011-2013 Ubiquitous Knowledge Processing (UKP) Lab. All Rights Reserved.