Package slice.core

Class IndexedRange

java.lang.Object
slice.core.IndexedRange

public final class IndexedRange
extends java.lang.Object
Author:
Finn Voichick, Dennis Cosgrove (http://www.cse.wustl.edu/~cosgroved/)
  • Constructor Summary

    Constructors 
    Constructor Description
    IndexedRange​(int sliceIndexId, int minInclusive, int maxExclusive)
    Creates an instance useful for slicing up work, composed of an index id, an inclusive lower bound, and an exclusive upper bound.
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(java.lang.Object obj)  
    void forEachIndex​(CheckedIntConsumer body)
    Performs the given consumer for each index [min, maxExclusive).
    int getMaxExclusive()
    Gets the exclusive upper bound of the slice.
    int getMinInclusive()
    Gets the inclusive lower bound of the slice.
    int getSliceIndexId()
    Gets the value of the slice index/ID.
    int hashCode()  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • IndexedRange

      public IndexedRange​(int sliceIndexId, int minInclusive, int maxExclusive)
      Creates an instance useful for slicing up work, composed of an index id, an inclusive lower bound, and an exclusive upper bound.
      Parameters:
      sliceIndexId - the id/index of the slice, negative values indicate invalidity
      minInclusive - the inclusive lower bound
      maxExclusive - the exclusive upper bound
  • Method Details

    • getSliceIndexId

      public int getSliceIndexId()
      Gets the value of the slice index/ID.
      Returns:
      the slice index
    • getMinInclusive

      public int getMinInclusive()
      Gets the inclusive lower bound of the slice.
      Returns:
      inclusive lower bound of the slice
    • getMaxExclusive

      public int getMaxExclusive()
      Gets the exclusive upper bound of the slice.
      Returns:
      exclusive upper bound of the slice
    • forEachIndex

      public void forEachIndex​(CheckedIntConsumer body) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
      Performs the given consumer for each index [min, maxExclusive).
      Parameters:
      body - the computation to be performed for each index
      Throws:
      java.lang.InterruptedException - if the computation was cancelled
      java.util.concurrent.ExecutionException - if the computation threw an exception
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object