public abstract class Rounding extends Object implements Streamable
Modifier and Type | Class and Description |
---|---|
static class |
Rounding.FactorRounding |
static class |
Rounding.Interval
Rounding strategy which is based on an interval
rounded = value - (value % interval) |
static class |
Rounding.OffsetRounding |
static class |
Rounding.Streams |
Constructor and Description |
---|
Rounding() |
Modifier and Type | Method and Description |
---|---|
abstract byte |
id() |
abstract long |
nextRoundingValue(long value)
Given the rounded value (which was potentially generated by
round(long) , returns the next rounding value. |
long |
round(long value)
Rounds the given value, equivalent to calling
roundValue(roundKey(value)) . |
abstract long |
roundKey(long value)
Given a value, compute a key that uniquely identifies the rounded value although it is not necessarily equal to the rounding value itself.
|
abstract long |
valueForKey(long key)
Compute the rounded value given the key that identifies it.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
readFrom, writeTo
public abstract byte id()
public abstract long roundKey(long value)
public abstract long valueForKey(long key)
public final long round(long value)
roundValue(roundKey(value))
.value
- The value to round.public abstract long nextRoundingValue(long value)
round(long)
, returns the next rounding value. For example, with
interval based rounding, if the interval is 3, nextRoundValue(6) = 9
.value
- The current rounding valueCopyright © 2009–2016. All rights reserved.