de.tudarmstadt.ukp.jwktl.api.util
Class HierarchicalWiktionaryIterator<IterableType,OuterType>

java.lang.Object
  extended by de.tudarmstadt.ukp.jwktl.api.util.WiktionaryIterator<IterableType>
      extended by de.tudarmstadt.ukp.jwktl.api.util.HierarchicalWiktionaryIterator<IterableType,OuterType>
Type Parameters:
IterableType - The type the inner iterator.
OuterType - The type the outer iterator.
All Implemented Interfaces:
IWiktionaryIterator<IterableType>, Iterable<IterableType>, Iterator<IterableType>

public abstract class HierarchicalWiktionaryIterator<IterableType,OuterType>
extends WiktionaryIterator<IterableType>

Generic implementation for an iterator of iterators. That is, an object, which is initialized with an iterator of type OuterType. This iterator is being iterated an converted into an iterator of type IterableType. For each element of the outer iterator, all elements of the inner iterator are then traversed. For example, a hierarchical iterator of outer type WiktionaryEntry and inner type WiktionarySense enumerates all senses of entry1, then all senses of entry2, etc.

Author:
Christian M. Meyer

Field Summary
protected  IWiktionaryIterator<IterableType> innerIterator
           
protected  Iterator<OuterType> outerIterator
           
 
Fields inherited from class de.tudarmstadt.ukp.jwktl.api.util.WiktionaryIterator
closed, nextValue
 
Constructor Summary
HierarchicalWiktionaryIterator(Iterator<OuterType> outerIterator)
          Initialize the iterator for the given outer type.
 
Method Summary
protected  void doClose()
          Hotspot that is invoked after closing the iteration, i.e. either all items are traversed or manual termination.
protected  IterableType fetchNext()
          Hotspot for fetching the next element for iteration.
protected abstract  IWiktionaryIterator<IterableType> getInnerIterator(OuterType outer)
           
 
Methods inherited from class de.tudarmstadt.ukp.jwktl.api.util.WiktionaryIterator
close, hasNext, isClosed, iterator, next, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outerIterator

protected Iterator<OuterType> outerIterator

innerIterator

protected IWiktionaryIterator<IterableType> innerIterator
Constructor Detail

HierarchicalWiktionaryIterator

public HierarchicalWiktionaryIterator(Iterator<OuterType> outerIterator)
Initialize the iterator for the given outer type.

Method Detail

fetchNext

protected IterableType 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<IterableType>

getInnerIterator

protected abstract IWiktionaryIterator<IterableType> getInnerIterator(OuterType outer)

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<IterableType>


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