![JAR search and dependency download from the Maven repository](/logo.png)
org.jsimpledb.index.Index2 Maven / Gradle / Ivy
Show all versions of jsimpledb-util Show documentation
/*
* Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
*/
package org.jsimpledb.index;
import java.util.NavigableMap;
import java.util.NavigableSet;
import org.jsimpledb.tuple.Tuple2;
import org.jsimpledb.tuple.Tuple3;
/**
* An index on two fields.
*
*
* Indexes are read-only and "live", always reflecting the current transaction state.
*
* @param first indexed value type
* @param second indexed value type
* @param index target type
* @see org.jsimpledb.index
*/
public interface Index2 {
/**
* 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 Index}s keyed by the first value.
*
* @return {@link NavigableMap} from first value to {@link Index}
*/
NavigableMap> asMapOfIndex();
/**
* Get the prefix of this instance that only includes the first two indexed fields.
*
* @return prefix of this index
*/
Index asIndex();
}