Class IntervalChunks


  • public class IntervalChunks
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      IntervalChunks()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<Interval> chunkInterval​(Interval interval, int numberOfChunks)
      Returns a list of disjoint intervals, that covers the given interval.
      (package private) static long divideAndRoundUp​(long a, long b)
      Returns a divided by b, and round up.
      (package private) static java.util.List<Interval> generateGrid​(Interval interval, long[] cellDimensions)
      Returns a list of disjoint intervals, that covers the given interval.
      (package private) static long[] suggestChunkSize​(long[] dimensions, long numberOfChunks)
      Suggest a chunk size that can be used, to divide an interval of the given dimensions, into the given number of chunks.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IntervalChunks

        public IntervalChunks()
    • Method Detail

      • chunkInterval

        public static java.util.List<Interval> chunkInterval​(Interval interval,
                                                             int numberOfChunks)
        Returns a list of disjoint intervals, that covers the given interval.

        Due to the divisibility of whole numbers, it not always easy to return the correct number of intervals, in that case this method returns a larger number of intervals.

      • suggestChunkSize

        static long[] suggestChunkSize​(long[] dimensions,
                                       long numberOfChunks)
        Suggest a chunk size that can be used, to divide an interval of the given dimensions, into the given number of chunks.
      • generateGrid

        static java.util.List<Interval> generateGrid​(Interval interval,
                                                     long[] cellDimensions)
        Returns a list of disjoint intervals, that covers the given interval. The dimension of returned intervals are equal to the given cellDimensions. With the exception of the intervals that are at the border of the given interval. These can be smaller.
      • divideAndRoundUp

        static long divideAndRoundUp​(long a,
                                     long b)
        Returns a divided by b, and round up.