Search in sources :

Example 11 with Interval

use of org.threeten.extra.Interval in project geowave by locationtech.

the class GeoWaveStatisticsIT method assertTimeBinning.

private static void assertTimeBinning(final DataStore ds, final TimeRangeStatistic stat, final int expectedCount, final Function<Interval, Duration> expectedDuration, final Interval overallInterval) {
    try (CloseableIterator<Pair<ByteArray, Interval>> iterator = ds.getBinnedStatisticValues(stat)) {
        int count = 0;
        while (iterator.hasNext()) {
            final Pair<ByteArray, Interval> binValue = iterator.next();
            final Interval binRange = ((TimeRangeFieldValueBinningStrategy) stat.getBinningStrategy()).getInterval(binValue.getKey());
            assertEquals(expectedDuration.apply(binValue.getValue()), binRange.toDuration());
            assertTrue(binRange.encloses(binValue.getValue()));
            assertTrue(overallInterval.encloses(binValue.getValue()));
            count++;
        }
        assertEquals(expectedCount, count);
    }
}
Also used : TimeRangeFieldValueBinningStrategy(org.locationtech.geowave.core.geotime.store.statistics.binning.TimeRangeFieldValueBinningStrategy) ByteArray(org.locationtech.geowave.core.index.ByteArray) Pair(org.apache.commons.lang3.tuple.Pair) Interval(org.threeten.extra.Interval)

Example 12 with Interval

use of org.threeten.extra.Interval in project geowave by locationtech.

the class TimeRangeAggregation method aggregate.

@Override
public void aggregate(final DataTypeAdapter<T> adapter, final T entry) {
    final Interval env = getInterval(entry);
    aggregate(env);
}
Also used : Interval(org.threeten.extra.Interval)

Example 13 with Interval

use of org.threeten.extra.Interval in project geowave by locationtech.

the class TemporalBetween method evaluate.

@Override
public boolean evaluate(final Map<String, Object> fieldValues) {
    final Interval value = TimeUtils.getInterval(valueExpr.evaluateValue(fieldValues));
    final Interval lowerBound = TimeUtils.getInterval(lowerBoundExpr.evaluateValue(fieldValues));
    final Interval upperBound = TimeUtils.getInterval(upperBoundExpr.evaluateValue(fieldValues));
    return evaluate(value, lowerBound, upperBound);
}
Also used : Interval(org.threeten.extra.Interval)

Example 14 with Interval

use of org.threeten.extra.Interval in project geowave by locationtech.

the class TemporalBetween method evaluate.

@Override
public <T> boolean evaluate(final DataTypeAdapter<T> adapter, final T entry) {
    final Interval value = TimeUtils.getInterval(valueExpr.evaluateValue(adapter, entry));
    final Interval lowerBound = TimeUtils.getInterval(lowerBoundExpr.evaluateValue(adapter, entry));
    final Interval upperBound = TimeUtils.getInterval(upperBoundExpr.evaluateValue(adapter, entry));
    return evaluate(value, lowerBound, upperBound);
}
Also used : Interval(org.threeten.extra.Interval)

Example 15 with Interval

use of org.threeten.extra.Interval in project geowave by locationtech.

the class TemporalBetween method getConstraints.

@SuppressWarnings("unchecked")
@Override
public <V extends Comparable<V>> FilterConstraints<V> getConstraints(final Class<V> constraintClass, final DataStatisticsStore statsStore, final DataTypeAdapter<?> adapter, final AdapterToIndexMapping indexMapping, final Index index, final Set<String> indexedFields) {
    if ((valueExpr instanceof FieldValue) && indexedFields.contains(((FieldValue<?>) valueExpr).getFieldName()) && lowerBoundExpr.isLiteral() && upperBoundExpr.isLiteral() && constraintClass.isAssignableFrom(Double.class)) {
        final Interval lowerBound = lowerBoundExpr.evaluateValue(null, null);
        final Interval upperBound = upperBoundExpr.evaluateValue(null, null);
        if ((lowerBound != null) && (upperBound != null)) {
            return FilterConstraints.of(adapter, indexMapping, index, ((FieldValue<?>) valueExpr).getFieldName(), (IndexFieldConstraints<V>) NumericFieldConstraints.of((double) lowerBound.getStart().toEpochMilli(), (double) TimeUtils.getIntervalEnd(upperBound).toEpochMilli(), true, false, index.getIndexStrategy() instanceof SimpleNumericIndexStrategy));
        }
    }
    return FilterConstraints.empty();
}
Also used : SimpleNumericIndexStrategy(org.locationtech.geowave.core.index.simple.SimpleNumericIndexStrategy) FieldValue(org.locationtech.geowave.core.store.query.filter.expression.FieldValue) Interval(org.threeten.extra.Interval)

Aggregations

Interval (org.threeten.extra.Interval)29 ZonedDateTime (java.time.ZonedDateTime)5 Test (org.junit.Test)5 Instant (java.time.Instant)4 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 FeaturesCoreConfiguration (de.ii.ogcapi.features.core.domain.FeaturesCoreConfiguration)2 ImmutableFeaturesCoreConfiguration (de.ii.ogcapi.features.core.domain.ImmutableFeaturesCoreConfiguration)2 FeatureTypeConfigurationOgcApi (de.ii.ogcapi.foundation.domain.FeatureTypeConfigurationOgcApi)2 TemporalExtent (de.ii.ogcapi.foundation.domain.TemporalExtent)2 Calendar (java.util.Calendar)2 List (java.util.List)2 Point (org.geojson.Point)2 After (org.locationtech.geowave.core.geotime.store.query.filter.expression.temporal.After)2 Before (org.locationtech.geowave.core.geotime.store.query.filter.expression.temporal.Before)2 BeforeOrDuring (org.locationtech.geowave.core.geotime.store.query.filter.expression.temporal.BeforeOrDuring)2 During (org.locationtech.geowave.core.geotime.store.query.filter.expression.temporal.During)2 DuringOrAfter (org.locationtech.geowave.core.geotime.store.query.filter.expression.temporal.DuringOrAfter)2 TemporalBetween (org.locationtech.geowave.core.geotime.store.query.filter.expression.temporal.TemporalBetween)2 TemporalFieldValue (org.locationtech.geowave.core.geotime.store.query.filter.expression.temporal.TemporalFieldValue)2