Interface Rounding.Prepared

Enclosing class:
Rounding

public static interface Rounding.Prepared
A strategy for rounding milliseconds since epoch.
  • Method Summary

    Modifier and Type Method Description
    long[] fixedRoundingPoints()
    If this rounding mechanism precalculates rounding points then this array stores dates such that each date between each entry.
    long nextRoundingValue​(long utcMillis)
    Given the rounded value (which was potentially generated by round(long), returns the next rounding value.
    long round​(long utcMillis)
    Rounds the given value.
    double roundingSize​(long utcMillis, Rounding.DateTimeUnit timeUnit)
    Given the rounded value, returns the size between this value and the next rounded value in specified units if possible.
    double roundingSize​(Rounding.DateTimeUnit timeUnit)
    Returns the size of each rounding bucket in timeUnits.
  • Method Details

    • round

      long round​(long utcMillis)
      Rounds the given value.
    • nextRoundingValue

      long nextRoundingValue​(long utcMillis)
      Given the rounded value (which was potentially generated by round(long), returns the next rounding value. For example, with interval based rounding, if the interval is 3, nextRoundValue(6) = 9.
    • roundingSize

      double roundingSize​(long utcMillis, Rounding.DateTimeUnit timeUnit)
      Given the rounded value, returns the size between this value and the next rounded value in specified units if possible.
    • roundingSize

      double roundingSize​(Rounding.DateTimeUnit timeUnit)
      Returns the size of each rounding bucket in timeUnits.
    • fixedRoundingPoints

      long[] fixedRoundingPoints()
      If this rounding mechanism precalculates rounding points then this array stores dates such that each date between each entry. if the rounding mechanism doesn't precalculate points then this is null.