public static class Rounding.Interval extends Rounding
rounded = value - (value % interval)
Rounding.FactorRounding, Rounding.Interval, Rounding.OffsetRounding, Rounding.Streams
Modifier and Type | Field and Description |
---|---|
static ParseField |
INTERVAL_FIELD |
Constructor and Description |
---|
Interval() |
Interval(long interval)
Creates a new interval rounding.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
byte |
id() |
long |
nextRoundingValue(long value)
Given the rounded value (which was potentially generated by
Rounding.round(long) , returns the next rounding value. |
void |
readFrom(StreamInput in)
Set this object's fields from a StreamInput.
|
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.
|
static long |
roundKey(long value,
long interval) |
static long |
roundValue(long key,
long interval) |
long |
valueForKey(long key)
Compute the rounded value given the key that identifies it.
|
void |
writeTo(StreamOutput out)
Write this object's fields to a StreamOutput.
|
public static final ParseField INTERVAL_FIELD
public Interval()
public Interval(long interval)
interval
- The intervalpublic static long roundKey(long value, long interval)
public static long roundValue(long key, long interval)
public long roundKey(long value)
Rounding
public long valueForKey(long key)
Rounding
valueForKey
in class Rounding
public long nextRoundingValue(long value)
Rounding
Rounding.round(long)
, returns the next rounding value. For example, with
interval based rounding, if the interval is 3, nextRoundValue(6) = 9
.nextRoundingValue
in class Rounding
value
- The current rounding valuepublic void readFrom(StreamInput in) throws java.io.IOException
Streamable
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Streamable
java.io.IOException