Class TimeRange
- java.lang.Object
-
- org.apache.iotdb.tsfile.read.common.TimeRange
-
-
Constructor Summary
Constructors Constructor Description TimeRange(long min, long max)Initialize a closed interval [min,max].
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(TimeRange r)booleancontains(long time)booleancontains(long min, long max)booleancontains(TimeRange r)Check whether this TimeRange contains r.booleanequals(java.lang.Object o)IExpressiongetExpression()booleangetLeftClose()longgetMax()Get the upper range boundary.longgetMin()Get the lower range bundary.java.util.List<TimeRange>getRemains(java.util.List<TimeRange> timeRangesPrev)Get the remaining time ranges in the current ranges but not in timeRangesPrev.booleangetRightClose()inthashCode()booleanintersects(TimeRange r)Here are some examples.voidmerge(TimeRange rhs)booleanoverlaps(TimeRange rhs)Check if two TimeRanges overlapvoidset(long min, long max)Set a closed interval [min,max].voidsetLeftClose(boolean leftClose)voidsetMax(long max)voidsetMin(long min)voidsetRightClose(boolean rightClose)static java.util.List<TimeRange>sortAndMerge(java.util.List<TimeRange> unionCandidates)Return the union of the given time ranges.java.lang.StringtoString()
-
-
-
Method Detail
-
compareTo
public int compareTo(TimeRange r)
- Specified by:
compareToin interfacejava.lang.Comparable<TimeRange>
-
setMin
public void setMin(long min)
-
setMax
public void setMax(long max)
-
contains
public boolean contains(TimeRange r)
Check whether this TimeRange contains r.- Returns:
- true if the given range lies in this range, inclusively
-
contains
public boolean contains(long min, long max)
-
contains
public boolean contains(long time)
-
set
public void set(long min, long max)Set a closed interval [min,max].- Parameters:
min- the left endpoint of the closed intervalmax- the right endpoint of the closed interval
-
getMin
public long getMin()
Get the lower range bundary.- Returns:
- The lower range boundary.
-
getMax
public long getMax()
Get the upper range boundary.- Returns:
- The upper range boundary.
-
intersects
public boolean intersects(TimeRange r)
Here are some examples.[1,3] does not intersect with (4,5].
[1,3) does not intersect with (3,5].
[1,3] does not intersect with [5,6].
[1,3] intersects with [2,5].
[1,3] intersects with (3,5].
[1,3) intersects with (2,5].
Note: this method treats [1,3] and [4,5] as two "intersected" interval even if they are not truly intersected.
- Parameters:
r- the given time range- Returns:
- true if the current time range "intersects" with the given time range r
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
overlaps
public boolean overlaps(TimeRange rhs)
Check if two TimeRanges overlap- Parameters:
rhs- the given time range- Returns:
- true if the current time range overlaps with the given time range rhs
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
setLeftClose
public void setLeftClose(boolean leftClose)
-
setRightClose
public void setRightClose(boolean rightClose)
-
getLeftClose
public boolean getLeftClose()
-
getRightClose
public boolean getRightClose()
-
sortAndMerge
public static java.util.List<TimeRange> sortAndMerge(java.util.List<TimeRange> unionCandidates)
Return the union of the given time ranges.- Parameters:
unionCandidates- time ranges to be merged- Returns:
- the union of time ranges
-
merge
public void merge(TimeRange rhs)
-
getRemains
public java.util.List<TimeRange> getRemains(java.util.List<TimeRange> timeRangesPrev)
Get the remaining time ranges in the current ranges but not in timeRangesPrev.NOTE the primitive timeRange is always a closed interval [min,max] and only in this function are leftClose and rightClose changed.
- Parameters:
timeRangesPrev- time ranges union in ascending order of the start time- Returns:
- the remaining time ranges
-
getExpression
public IExpression getExpression()
-
-