@InterfaceAudience.Public @InterfaceStability.Stable public class TimeRange extends Object
Evaluated according to minStamp <= timestamp < maxStamp or [minStamp,maxStamp) in interval notation.
Only used internally; should not be accessed directly by clients.
Modifier and Type | Field and Description |
---|---|
private boolean |
allTime |
private long |
maxStamp |
private long |
minStamp |
Constructor and Description |
---|
TimeRange()
Deprecated.
This is made @InterfaceAudience.Private in the 2.0 line and above
|
TimeRange(byte[] minStamp)
Deprecated.
This is removed in the 2.0 line and above
|
TimeRange(byte[] minStamp,
byte[] maxStamp)
Deprecated.
This is removed in the 2.0 line and above
|
TimeRange(long minStamp)
Deprecated.
This is made @InterfaceAudience.Private in the 2.0 line and above
|
TimeRange(long minStamp,
long maxStamp)
Deprecated.
This is made @InterfaceAudience.Private in the 2.0 line and above
|
Modifier and Type | Method and Description |
---|---|
int |
compare(long timestamp)
Compare the timestamp to timerange
|
long |
getMax() |
long |
getMin() |
boolean |
isAllTime()
Check if it is for all time
|
String |
toString() |
boolean |
withinOrAfterTimeRange(long timestamp)
Check if the specified timestamp is within this TimeRange.
|
boolean |
withinTimeRange(byte[] bytes,
int offset)
Check if the specified timestamp is within this TimeRange.
|
boolean |
withinTimeRange(long timestamp)
Check if the specified timestamp is within this TimeRange.
|
private long minStamp
private long maxStamp
private boolean allTime
@Deprecated public TimeRange()
@Deprecated public TimeRange(long minStamp)
minStamp
- the minimum timestamp value, inclusive@Deprecated public TimeRange(byte[] minStamp)
minStamp
- the minimum timestamp value, inclusive@Deprecated public TimeRange(long minStamp, long maxStamp) throws IOException
minStamp
- the minimum timestamp, inclusivemaxStamp
- the maximum timestamp, exclusiveIllegalArgumentException
- if either <0,IOException
- if max smaller than min.@Deprecated public TimeRange(byte[] minStamp, byte[] maxStamp) throws IOException
minStamp
- the minimum timestamp, inclusivemaxStamp
- the maximum timestamp, exclusiveIOException
public long getMin()
public long getMax()
public boolean isAllTime()
public boolean withinTimeRange(byte[] bytes, int offset)
Returns true if within interval [minStamp, maxStamp), false if not.
bytes
- timestamp to checkoffset
- offset into the bytespublic boolean withinTimeRange(long timestamp)
Returns true if within interval [minStamp, maxStamp), false if not.
timestamp
- timestamp to checkpublic boolean withinOrAfterTimeRange(long timestamp)
Returns true if within interval [minStamp, maxStamp), false if not.
timestamp
- timestamp to checkpublic int compare(long timestamp)
timestamp
- Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.