io.permazen.index.Index3 Maven / Gradle / Ivy
Show all versions of permazen-util Show documentation
/*
* Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
*/
package io.permazen.index;
import io.permazen.tuple.Tuple2;
import io.permazen.tuple.Tuple3;
import io.permazen.tuple.Tuple4;
import io.permazen.util.Bounds;
import java.util.NavigableMap;
import java.util.NavigableSet;
/**
* An index on three fields.
*
*
* Indexes are read-only and "live", always reflecting the current transaction state.
*
* @param first indexed value type
* @param second indexed value type
* @param third indexed value type
* @param index target type
* @see io.permazen.index
*/
public interface Index3 extends Index {
@Override
default int numberOfFields() {
return 3;
}
/**
* View this index as a {@link NavigableSet} of tuples.
*
* @return {@link NavigableSet} of tuples containing indexed values and target value
*/
NavigableSet> asSet();
/**
* View this index as a {@link NavigableMap} of target values keyed by indexed value tuples.
*
* @return {@link NavigableMap} from indexed value tuple to the corresponding set of target objects
*/
NavigableMap, NavigableSet> asMap();
/**
* View this index as a {@link NavigableMap} of {@link Index1}s keyed by the first two values.
*
* @return {@link NavigableMap} from first two values to {@link Index1}
*/
NavigableMap, Index1> asMapOfIndex1();
/**
* View this index as a {@link NavigableMap} of {@link Index2}s keyed by the first value.
*
* @return {@link NavigableMap} from first value to {@link Index2}
*/
NavigableMap> asMapOfIndex2();
/**
* Get the prefix of this instance that only includes the first three indexed fields.
*
* @return prefix of this index
*/
Index2 asIndex2();
/**
* Get the prefix of this instance that only includes the first two indexed fields.
*
* @return prefix of this index
*/
Index1 asIndex1();
/**
* Impose {@link Bounds} that restrict the range of the first indexed value.
*
* @param bounds bounds to impose on the first indexed value
* @return a view of this index in which only first values within {@code bounds} are visible
*/
Index3 withValue1Bounds(Bounds bounds);
/**
* Impose {@link Bounds} that restrict the range of the second indexed value.
*
* @param bounds bounds to impose on the second indexed value
* @return a view of this index in which only second values within {@code bounds} are visible
*/
Index3 withValue2Bounds(Bounds bounds);
/**
* Impose {@link Bounds} that restrict the range of the third indexed value.
*
* @param bounds bounds to impose on the third indexed value
* @return a view of this index in which only third values within {@code bounds} are visible
*/
Index3 withValue3Bounds(Bounds bounds);
/**
* Impose {@link Bounds} that restrict the range of the target value.
*
* @param bounds bounds to impose on the target value
* @return a view of this index in which only target values within {@code bounds} are visible
*/
Index3 withTargetBounds(Bounds bounds);
}