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
FieldsModifier and TypeFieldDescriptionprivate static final TimeRangeprivate final booleanstatic final longstatic final longprivate final longprivate final long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTimeRange(long minStamp, long maxStamp) Represents interval [minStamp, maxStamp) -
Method Summary
Modifier and TypeMethodDescriptionstatic TimeRangeallTime()static TimeRangeat(long ts) static TimeRangebetween(long minStamp, long maxStamp) Represents the time interval [minStamp, maxStamp)private static voidcheck(long minStamp, long maxStamp) intcompare(long timestamp) Compare the timestamp to timerange.static TimeRangefrom(long minStamp) Represents the time interval [minStamp, Long.MAX_VALUE)longgetMax()Returns the biggest timestamp that should be consideredlonggetMin()Returns the smallest timestamp that should be consideredbooleanCheck if the range has any overlap with TimeRangebooleanCheck if it is for all timeprivate static booleanisAllTime(long minStamp, long maxStamp) toString()static TimeRangeuntil(long maxStamp) Represents the time interval [0, maxStamp)booleanwithinOrAfterTimeRange(long timestamp) Check if the specified timestamp is within or after this TimeRange.booleanwithinTimeRange(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
-