generalize op source

This commit is contained in:
Jonathan Shook 2020-11-16 17:22:43 -06:00
parent 089a29d846
commit 8313613943
2 changed files with 29 additions and 11 deletions

View File

@ -23,19 +23,10 @@ import java.util.function.Function;
/**
* An OpSequence provides fast access to a set of operations in a specific
* order.
*
* @param <T> The type of element which is to be sequenced
*/
public interface OpSequence<T> {
/**
* Get the next operation for the given long value. This is simply
* the offset indicated by the offset sequence array at a modulo
* position.
*
* @param selector the long value that determines the next op
* @return An op of type T
*/
T get(long selector);
public interface OpSequence<T> extends OpSource<T> {
/**
* Get the list of individual operations which could be returned by {@link #get(long)}.

View File

@ -0,0 +1,27 @@
package io.nosqlbench.engine.api.activityapi.planning;
import java.util.function.LongFunction;
/**
* An OpSource provides an Op when given an ordinal.
* OpSources are expected to be deterministic with respect to inputs.
*
* @param <T>
*/
public interface OpSource<T> extends LongFunction<T> {
/**
* Get the next operation for the given long value. This is simply
* the offset indicated by the offset sequence array at a modulo
* position.
*
* @param selector the long value that determines the next op
* @return An op of type T
*/
T get(long selector);
@Override
default T apply(long value) {
return get(value);
}
}