Search in sources :

Example 1 with MaskTimestampSetByTimeRange

use of uk.gov.gchq.gaffer.time.function.MaskTimestampSetByTimeRange in project Gaffer by gchq.

the class RBMBackedTimestampSetInRange method test.

@Override
public boolean test(final RBMBackedTimestampSet rbmBackedTimestampSet) {
    if (rbmBackedTimestampSet == null) {
        throw new IllegalArgumentException("TimestampSet cannot be null");
    }
    if (rbmBackedTimestampSet.getNumberOfTimestamps() == 0) {
        throw new IllegalArgumentException("TimestampSet must contain at least one value");
    }
    Long startEpoch = startTime != null ? startTime.longValue() : null;
    Long endEpoch = endTime != null ? endTime.longValue() : null;
    RBMBackedTimestampSet masked = new MaskTimestampSetByTimeRange(startEpoch, endEpoch, timeUnit).apply(rbmBackedTimestampSet);
    if (includeAllTimestamps) {
        return masked.equals(rbmBackedTimestampSet);
    } else {
        return masked.getNumberOfTimestamps() > 0L;
    }
}
Also used : RBMBackedTimestampSet(uk.gov.gchq.gaffer.time.RBMBackedTimestampSet) MaskTimestampSetByTimeRange(uk.gov.gchq.gaffer.time.function.MaskTimestampSetByTimeRange)

Aggregations

RBMBackedTimestampSet (uk.gov.gchq.gaffer.time.RBMBackedTimestampSet)1 MaskTimestampSetByTimeRange (uk.gov.gchq.gaffer.time.function.MaskTimestampSetByTimeRange)1