Package net.vleo.timel.iterator
Class NestedLoopTimeIterator<S,D>
- java.lang.Object
-
- net.vleo.timel.iterator.NestedLoopTimeIterator<S,D>
-
- Type Parameters:
S
- Source value Java typeD
- Target value Java type
- All Implemented Interfaces:
TimeIterator<D>
- Direct Known Subclasses:
NestedLoopUpscalableIterator
public abstract class NestedLoopTimeIterator<S,D> extends Object implements TimeIterator<D>
A nested loop iterator which allows, for each iteration of a given TimeIterator, to loop over a nested iterator.- Author:
- Andrea Leofreddi
-
-
Field Summary
Fields Modifier and Type Field Description protected TimeIterator<S>
iterator
protected TimeIterator<D>
nestedIterator
-
Constructor Summary
Constructors Modifier Constructor Description protected
NestedLoopTimeIterator(TimeIterator<S> iterator)
Protected constructor.
-
Method Summary
Modifier and Type Method Description boolean
hasNext()
Test if there is a next element.protected abstract TimeIterator<D>
nestedIterator(Sample<S> value)
Sample<D>
next()
Move forward the iterator and return the next value.Sample<D>
peekNext()
Peek the next element without moving forward the iterator.String
toString()
-
-
-
Field Detail
-
iterator
protected final TimeIterator<S> iterator
-
nestedIterator
protected TimeIterator<D> nestedIterator
-
-
Constructor Detail
-
NestedLoopTimeIterator
protected NestedLoopTimeIterator(TimeIterator<S> iterator)
Protected constructor.- Parameters:
iterator
- Source iterator
-
-
Method Detail
-
nestedIterator
protected abstract TimeIterator<D> nestedIterator(Sample<S> value)
-
next
public final Sample<D> next() throws NoSuchElementException
Description copied from interface:TimeIterator
Move forward the iterator and return the next value.- Specified by:
next
in interfaceTimeIterator<S>
- Returns:
- The next sample
- Throws:
NoSuchElementException
- If there is no next element
-
peekNext
public final Sample<D> peekNext() throws NoSuchElementException
Description copied from interface:TimeIterator
Peek the next element without moving forward the iterator.- Specified by:
peekNext
in interfaceTimeIterator<S>
- Returns:
- The next sample
- Throws:
NoSuchElementException
- If there is no next element
-
hasNext
public final boolean hasNext()
Description copied from interface:TimeIterator
Test if there is a next element.- Specified by:
hasNext
in interfaceTimeIterator<S>
- Returns:
- True iff there is a next element
-
-