Class Rounding

  • All Implemented Interfaces:
    Writeable

    public abstract class Rounding
    extends java.lang.Object
    implements Writeable
    A strategy for rounding long values.
    • Constructor Summary

      Constructors 
      Constructor Description
      Rounding()  
    • Method Summary

      Modifier and Type Method Description
      static Rounding.Builder builder​(DateTimeUnit unit)  
      static Rounding.Builder builder​(TimeValue interval)  
      abstract boolean equals​(java.lang.Object obj)  
      abstract int hashCode()  
      abstract byte id()  
      abstract long nextRoundingValue​(long value)
      Given the rounded value (which was potentially generated by round(long), returns the next rounding value.
      abstract long round​(long value)
      Rounds the given value.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.elasticsearch.common.io.stream.Writeable

        writeTo
    • Constructor Detail

      • Rounding

        public Rounding()
    • Method Detail

      • id

        public abstract byte id()
      • round

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

        public abstract long nextRoundingValue​(long value)
        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 .
        Parameters:
        value - The current rounding value
        Returns:
        The next rounding value;
      • equals

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

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