public abstract class AbstractInTimeRangeDual<T extends Comparable<T>> extends KoryphePredicate2<Comparable<T>,Comparable<T>>
An AbstractInTimeRangeDual
is a Predicate
that tests if a start Comparable
and end Comparable
is
within a provided range [start, end]. Specifically the start Comparable
has to be greater than the start bound and the end Comparable
has to
be less than the end bound.
By default the range is inclusive, you can toggle this using the startInclusive
and endInclusive booleans.
If the start is not set then this will be treated as unbounded. Similarly with the end.
If the test value is null then the predicate will return false.
This range predicate takes 2 values to test, if you want to test
a single value lies within a range then you can use the
AbstractInTimeRange
predicate.
The range can also be configured using time offsets from the current system time or a provided start/end time. You can set the start and end offsets using startOffset and endOffset. By default the offset is measured in Days, this can be changed to DAY, HOUR, MINUTE, SECOND, MILLISECOND and MICROSECOND using the offsetUnit field.
At the point when test is called on the class the current system time is used to calculate the start and end values based on: System.currentTimeMillis() + offset.
By default checks are carried out assuming the data will be in milliseconds. If this is not the case you can change the time unit using the timeUnit property.
You can configure the start and end time strings using one of the following formats:
Modifier and Type | Class and Description |
---|---|
static class |
AbstractInTimeRangeDual.BaseBuilder<B extends AbstractInTimeRangeDual.BaseBuilder<B,R,T>,R extends AbstractInTimeRangeDual<T>,T extends Comparable<T>> |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getEnd() |
Long |
getEndOffset() |
TimeUnit |
getOffsetUnit() |
String |
getStart() |
Long |
getStartOffset() |
TimeUnit |
getTimeUnit() |
TimeZone |
getTimeZone() |
String |
getTimeZoneId() |
int |
hashCode() |
void |
initialise() |
Boolean |
isEndFullyContained() |
Boolean |
isEndInclusive() |
Boolean |
isStartFullyContained() |
Boolean |
isStartInclusive() |
boolean |
test(Comparable<T> startValue,
Comparable<T> endValue) |
String |
toString() |
test
public void initialise()
public boolean test(Comparable<T> startValue, Comparable<T> endValue)
test
in class KoryphePredicate2<Comparable<T extends Comparable<T>>,Comparable<T extends Comparable<T>>>
public boolean equals(Object obj)
equals
in class KoryphePredicate<Tuple2<Comparable<T extends Comparable<T>>,Comparable<T extends Comparable<T>>>>
public int hashCode()
hashCode
in class KoryphePredicate<Tuple2<Comparable<T extends Comparable<T>>,Comparable<T extends Comparable<T>>>>
public Long getStartOffset()
public String getStart()
public Boolean isStartInclusive()
public Boolean isStartFullyContained()
public String getEnd()
public Long getEndOffset()
public Boolean isEndInclusive()
public Boolean isEndFullyContained()
public TimeUnit getOffsetUnit()
public TimeUnit getTimeUnit()
public TimeZone getTimeZone()
public String getTimeZoneId()
Copyright © 2021. All rights reserved.