Package slice.core
Class IndexedRange
java.lang.Object
slice.core.IndexedRange
- Author:
- Finn Voichick, Dennis Cosgrove (http://www.cse.wustl.edu/~cosgroved/)
-
Constructor Summary
ConstructorsConstructorDescriptionIndexedRange(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 TypeMethodDescriptionbooleanvoidforEachIndex(CheckedIntConsumer body)Performs the given consumer for each index [min, maxExclusive).intGets the exclusive upper bound of the slice.intGets the inclusive lower bound of the slice.intGets the value of the slice index/ID.inthashCode()toString()
-
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 invalidityminInclusive- the inclusive lower boundmaxExclusive- 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
Performs the given consumer for each index [min, maxExclusive).- Parameters:
body- the computation to be performed for each index- Throws:
InterruptedException- if the computation was cancelledExecutionException- if the computation threw an exception
-
hashCode
public int hashCode() -
equals
-
toString
-