T
- the class of the filtered datapublic class FilterRange<T extends Comparable<T>> extends Object implements Comparable<FilterRange<T>>
Constructor and Description |
---|
FilterRange(T start,
T end,
boolean startInclusive,
boolean endInclusive,
boolean exact)
Create a new filter range with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(FilterRange<T> o) |
boolean |
equals(Object other) |
T |
getEnd() |
T |
getStart() |
int |
hashCode() |
static <T extends Comparable<T>> |
include()
Creates a new filter range that represents all data.
|
static <T extends Comparable<T>> |
intersectRanges(List<FilterRange<T>> ranges1,
List<FilterRange<T>> ranges2)
Intersects a list of filter ranges with another list of filter ranges.
|
static <T extends Comparable<T>> |
invertRanges(List<FilterRange<T>> ranges)
Inverts a list of filter ranges.
|
protected boolean |
isAfter(FilterRange<T> other,
boolean startPoint) |
protected boolean |
isBefore(FilterRange<T> other,
boolean startPoint) |
boolean |
isEndInclusive() |
boolean |
isExact() |
boolean |
isFullRange() |
boolean |
isStartInclusive() |
static <T extends Comparable<T>> |
mergeRanges(List<FilterRange<T>> ranges)
Merges a list of filter ranges into their most simple form.
|
static <T extends Comparable<T>> |
of(T start,
T end,
boolean startInclusive,
boolean endInclusive,
boolean exact)
Create a new filter range with the given parameters.
|
protected boolean |
overlaps(FilterRange<T> other) |
public FilterRange(@Nullable T start, @Nullable T end, boolean startInclusive, boolean endInclusive, boolean exact)
null
start indicates an open
ended start, while a null
end indicates an open ended end.start
- the start of the rangeend
- the end of the rangestartInclusive
- whether or not the start is inclusiveendInclusive
- whether or not the end is inclusiveexact
- whether or not this range exactly represents the predicatepublic T getStart()
public T getEnd()
public boolean isStartInclusive()
public boolean isEndInclusive()
public boolean isExact()
true
if this range exactly represents the predicatepublic boolean isFullRange()
true
if this range represents all dataprotected boolean isAfter(FilterRange<T> other, boolean startPoint)
protected boolean isBefore(FilterRange<T> other, boolean startPoint)
protected boolean overlaps(FilterRange<T> other)
public int compareTo(FilterRange<T> o)
compareTo
in interface Comparable<FilterRange<T extends Comparable<T>>>
public static <T extends Comparable<T>> FilterRange<T> of(T start, T end, boolean startInclusive, boolean endInclusive, boolean exact)
null
start indicates an open
ended start, while a null
end indicates an open ended end.T
- the class of the filter rangestart
- the start of the rangeend
- the end of the rangestartInclusive
- whether or not the start is inclusiveendInclusive
- whether or not the end is inclusiveexact
- whether or not this range exactly represents the predicatepublic static <T extends Comparable<T>> FilterRange<T> include()
T
- the class of the filter rangepublic static <T extends Comparable<T>> List<FilterRange<T>> mergeRanges(List<FilterRange<T>> ranges)
T
- the class of the filter rangeranges
- the ranges to mergepublic static <T extends Comparable<T>> List<FilterRange<T>> intersectRanges(List<FilterRange<T>> ranges1, List<FilterRange<T>> ranges2)
T
- the class of the filter rangeranges1
- the first set of rangesranges2
- the second set of rangespublic static <T extends Comparable<T>> List<FilterRange<T>> invertRanges(List<FilterRange<T>> ranges)
T
- the class of the filter rangeranges
- the ranges to invertCopyright © 2013–2022. All rights reserved.