Package kmer.lab.core

Class ByteArraySlice

java.lang.Object
kmer.lab.core.ByteArraySlice

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

    • ByteArraySlice

      public ByteArraySlice​(byte[] originalUnslicedData, int minInclusive, int maxExclusive)
      Creates a new slice composed of the original unsliced data, an inclusive lower bound, and an exclusive upper bound.
      Parameters:
      originalUnslicedData - context of what was sliced
      minInclusive - the inclusive lower bound
      maxExclusive - the exclusive upper bound
  • Method Details

    • getOriginalUnslicedData

      public byte[] getOriginalUnslicedData()
      Gets the data associated with the slice. This will typically be an array of which the slice is a section.
      Returns:
      the original unsliced data associated with the slice
    • 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 InterruptedException, ExecutionException
      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 cancelled
      ExecutionException - if the computation threw an exception
    • hashCode

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

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

      public String toString()
      Overrides:
      toString in class Object