org.apache.hadoop.hbase.io
Class TimeRange

java.lang.Object
  extended by org.apache.hadoop.hbase.io.TimeRange

@InterfaceAudience.Public
@InterfaceStability.Stable
public class TimeRange
extends Object

Represents an interval of version timestamps.

Evaluated according to minStamp <= timestamp < maxStamp or [minStamp,maxStamp) in interval notation.

Only used internally; should not be accessed directly by clients.


Constructor Summary
TimeRange()
          Default constructor.
TimeRange(byte[] minStamp)
          Represents interval [minStamp, Long.MAX_VALUE)
TimeRange(byte[] minStamp, byte[] maxStamp)
          Represents interval [minStamp, maxStamp)
TimeRange(long minStamp)
          Represents interval [minStamp, Long.MAX_VALUE)
TimeRange(long minStamp, long maxStamp)
          Represents interval [minStamp, maxStamp)
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeRange

public TimeRange()
Default constructor. Represents interval [0, Long.MAX_VALUE) (allTime)


TimeRange

public TimeRange(long minStamp)
Represents interval [minStamp, Long.MAX_VALUE)

Parameters:
minStamp - the minimum timestamp value, inclusive

TimeRange

public TimeRange(byte[] minStamp)
Represents interval [minStamp, Long.MAX_VALUE)

Parameters:
minStamp - the minimum timestamp value, inclusive

TimeRange

public TimeRange(long minStamp,
                 long maxStamp)
          throws IOException
Represents interval [minStamp, maxStamp)

Parameters:
minStamp - the minimum timestamp, inclusive
maxStamp - the maximum timestamp, exclusive
Throws:
IOException

TimeRange

public TimeRange(byte[] minStamp,
                 byte[] maxStamp)
          throws IOException
Represents interval [minStamp, maxStamp)

Parameters:
minStamp - the minimum timestamp, inclusive
maxStamp - the maximum timestamp, exclusive
Throws:
IOException
Method Detail

getMin

public long getMin()
Returns:
the smallest timestamp that should be considered

getMax

public long getMax()
Returns:
the biggest timestamp that should be considered

isAllTime

public boolean isAllTime()
Check if it is for all time

Returns:
true if it is for all time

withinTimeRange

public boolean withinTimeRange(byte[] bytes,
                               int offset)
Check if the specified timestamp is within this TimeRange.

Returns true if within interval [minStamp, maxStamp), false if not.

Parameters:
bytes - timestamp to check
offset - offset into the bytes
Returns:
true if within TimeRange, false if not

withinTimeRange

public boolean withinTimeRange(long timestamp)
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

withinOrAfterTimeRange

public boolean withinOrAfterTimeRange(long timestamp)
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

compare

public int compare(long timestamp)
Compare the timestamp to timerange

Parameters:
timestamp -
Returns:
-1 if timestamp is less than timerange, 0 if timestamp is within timerange, 1 if timestamp is greater than timerange

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015 The Apache Software Foundation. All Rights Reserved.