Package org.apache.hadoop.hbase.io
Class TimeRange
java.lang.Object
org.apache.hadoop.hbase.io.TimeRange
Represents an interval of version timestamps. Presumes timestamps between
INITIAL_MIN_TIMESTAMP
and INITIAL_MAX_TIMESTAMP
only. Gets freaked out if
passed a timestamp that is < INITIAL_MIN_TIMESTAMP
,
Evaluated according to minStamp <= timestamp < maxStamp or [minStamp,maxStamp) in interval
notation.
Can be returned and read by clients. Should not be directly created by clients. Thus, all
constructors are purposely @InterfaceAudience.Private.
Immutable. Thread-safe.-
Field Summary
Modifier and TypeFieldDescriptionprivate static final TimeRange
private final boolean
static final long
static final long
private final long
private final long
-
Constructor Summary
ModifierConstructorDescriptionprivate
TimeRange
(long minStamp, long maxStamp) Represents interval [minStamp, maxStamp) -
Method Summary
Modifier and TypeMethodDescriptionstatic TimeRange
allTime()
static TimeRange
at
(long ts) static TimeRange
between
(long minStamp, long maxStamp) Represents the time interval [minStamp, maxStamp)private static void
check
(long minStamp, long maxStamp) int
compare
(long timestamp) Compare the timestamp to timerange.static TimeRange
from
(long minStamp) Represents the time interval [minStamp, Long.MAX_VALUE)long
getMax()
Returns the biggest timestamp that should be consideredlong
getMin()
Returns the smallest timestamp that should be consideredboolean
Check if the range has any overlap with TimeRangeboolean
Check if it is for all timeprivate static boolean
isAllTime
(long minStamp, long maxStamp) toString()
static TimeRange
until
(long maxStamp) Represents the time interval [0, maxStamp)boolean
withinOrAfterTimeRange
(long timestamp) Check if the specified timestamp is within or after this TimeRange.boolean
withinTimeRange
(long timestamp) Check if the specified timestamp is within this TimeRange.
-
Field Details
-
INITIAL_MIN_TIMESTAMP
- See Also:
-
INITIAL_MAX_TIMESTAMP
- See Also:
-
ALL_TIME
-
minStamp
-
maxStamp
-
allTime
-
-
Constructor Details
-
TimeRange
Represents interval [minStamp, maxStamp)- Parameters:
minStamp
- the minimum timestamp, inclusivemaxStamp
- the maximum timestamp, exclusive- Throws:
IllegalArgumentException
- if either <0,
-
-
Method Details
-
allTime
-
at
-
from
Represents the time interval [minStamp, Long.MAX_VALUE)- Parameters:
minStamp
- the minimum timestamp value, inclusive
-
until
Represents the time interval [0, maxStamp)- Parameters:
maxStamp
- the minimum timestamp value, exclusive
-
between
Represents the time interval [minStamp, maxStamp)- Parameters:
minStamp
- the minimum timestamp, inclusivemaxStamp
- the maximum timestamp, exclusive
-
isAllTime
-
check
-
getMin
Returns the smallest timestamp that should be considered -
getMax
Returns the biggest timestamp that should be considered -
isAllTime
Check if it is for all time- Returns:
- true if it is for all time
-
withinTimeRange
Check if the specified timestamp is within this TimeRange. Returns true if within interval [minStamp, maxStamp), false if not.- Parameters:
timestamp
- timestamp to check- Returns:
- true if within TimeRange, false if not
-
includesTimeRange
Check if the range has any overlap with TimeRange- Parameters:
tr
- TimeRange- Returns:
- True if there is overlap, false otherwise
-
withinOrAfterTimeRange
Check if the specified timestamp is within or after this TimeRange.Returns true if greater than minStamp, false if not.
- Parameters:
timestamp
- timestamp to check- Returns:
- true if within or after TimeRange, false if not
-
compare
Compare the timestamp to timerange.- Returns:
- -1 if timestamp is less than timerange, 0 if timestamp is within timerange, 1 if timestamp is greater than timerange
-
toString
-