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

    Fields 
    Modifier and Type Field Description
    (package private) int down
    Pointers.
    (package private) java.util.List<java.lang.Integer> positions
    The position list.
    (package private) int up
    Pointers.
  • 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.Iterator

    forEachRemaining, remove
  • Field Details

    • positions

      java.util.List<java.lang.Integer> positions
      The position list.
    • up

      int up
      Pointers.
    • down

      int down
      Pointers.
  • 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 interface java.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 interface java.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.