Class ORecordIteratorClusters<REC extends ORecord>

java.lang.Object
com.orientechnologies.orient.core.iterator.OIdentifiableIterator<REC>
com.orientechnologies.orient.core.iterator.ORecordIteratorClusters<REC>
All Implemented Interfaces:
Iterable<REC>, Iterator<REC>
Direct Known Subclasses:
ORecordIteratorClass

public class ORecordIteratorClusters<REC extends ORecord> extends OIdentifiableIterator<REC>
Iterator to browse multiple clusters forward and backward. Once browsed in a direction, the iterator cannot change it. This iterator with "live updates" set is able to catch updates to the cluster sizes while browsing. This is the case when concurrent clients/threads insert and remove item in any cluster the iterator is browsing. If the cluster are hot removed by from the database the iterator could be invalid and throw exception of cluster not found.
Author:
Luca Garulli (l.garulli--(at)--orientdb.com)
  • Field Details

    • clusterIds

      protected int[] clusterIds
    • currentClusterIdx

      protected int currentClusterIdx
    • currentRecord

      protected ORecord currentRecord
    • beginRange

      protected ORID beginRange
    • endRange

      protected ORID endRange
  • Constructor Details

  • Method Details

    • setRange

      public ORecordIteratorClusters<REC> setRange(ORID iBegin, ORID iEnd)
    • hasPrevious

      public boolean hasPrevious()
      Specified by:
      hasPrevious in class OIdentifiableIterator<REC extends ORecord>
    • hasNext

      public boolean hasNext()
    • next

      public REC next()
      Return the element at the current position and move forward the stream to the next position available.
      Returns:
      the next record found, otherwise the NoSuchElementException exception is thrown when no more records are found.
    • previous

      public REC previous()
      Return the element at the current position and move backward the stream to the previous position available.
      Specified by:
      previous in class OIdentifiableIterator<REC extends ORecord>
      Returns:
      the previous record found, otherwise the NoSuchElementException exception is thrown when no more records are found.
    • begin

      public ORecordIteratorClusters<REC> begin()
      Move the iterator to the begin of the range. If no range was specified move to the first record of the cluster.
      Specified by:
      begin in class OIdentifiableIterator<REC extends ORecord>
      Returns:
      The object itself
    • last

      public ORecordIteratorClusters<REC> last()
      Move the iterator to the end of the range. If no range was specified move to the last record of the cluster.
      Specified by:
      last in class OIdentifiableIterator<REC extends ORecord>
      Returns:
      The object itself
    • setLiveUpdated

      public ORecordIteratorClusters<REC> setLiveUpdated(boolean iLiveUpdated)
      Tell to the iterator that the upper limit must be checked at every cycle. Useful when concurrent deletes or additions change the size of the cluster while you're browsing it. Default is false.
      Overrides:
      setLiveUpdated in class OIdentifiableIterator<REC extends ORecord>
      Parameters:
      iLiveUpdated - True to activate it, otherwise false (default)
      See Also:
    • getBeginRange

      public ORID getBeginRange()
    • getEndRange

      public ORID getEndRange()
    • getClusterIds

      public int[] getClusterIds()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • include

      protected boolean include(ORecord iRecord)
    • updateClusterRange

      protected void updateClusterRange()
    • config

      protected void config()