Class PositionsIterator
java.lang.Object
es.uam.eps.ir.relison.content.index.structure.positional.PositionsIterator
- All Implemented Interfaces:
java.util.Iterator<java.lang.Integer>
public class PositionsIterator
extends java.lang.Object
implements java.util.Iterator<java.lang.Integer>
Iterator over a list of positions
-
Field Summary
-
Constructor Summary
Constructors Constructor Description PositionsIterator(java.util.List<java.lang.Integer> pos)
Obtains a list of positions. -
Method Summary
Modifier and Type Method Description boolean
hasNext()
Indicates whether the list has a next position.java.lang.Integer
next()
The next position in the position list.java.lang.Integer
nextAfter(int pos)
Obtains the first element after a given position.java.lang.Integer
nextBefore(int pos)
Obtains the first element before a given position.
-
Field Details
-
Constructor Details
-
PositionsIterator
public PositionsIterator(java.util.List<java.lang.Integer> pos)Obtains a list of positions.- Parameters:
pos
- the list of positions.
-
-
Method Details
-
hasNext
public boolean hasNext()Indicates whether the list has a next position.- Specified by:
hasNext
in interfacejava.util.Iterator<java.lang.Integer>
- Returns:
- true if it has, false otherwise.
-
next
public java.lang.Integer next()The next position in the position list.- Specified by:
next
in interfacejava.util.Iterator<java.lang.Integer>
- Returns:
- the position.
-
nextAfter
public java.lang.Integer nextAfter(int pos)Obtains the first element after a given position.- Parameters:
pos
- the position.- Returns:
- the next element after a given position.
-
nextBefore
public java.lang.Integer nextBefore(int pos)Obtains the first element before a given position.- Parameters:
pos
- the position.- Returns:
- the next element before a given position.
-