mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-02 05:19:19 -06:00
Update List Functions
This commit is contained in:
parent
6b89da98bb
commit
612413cf09
@ -30,15 +30,13 @@ public class ListHashed implements LongFunction<List<Object>> {
|
||||
|
||||
private final List<LongFunction<? extends Object>> valueFuncs;
|
||||
private final int size;
|
||||
private final LongToIntFunction sizeFunc;
|
||||
private final Hash hasher = new Hash();
|
||||
|
||||
@Example({
|
||||
"ListFunctions(NumberNameToString(),NumberNameToString())",
|
||||
"Create a list of ['one','one']"
|
||||
})
|
||||
public ListHashed(LongToIntFunction sizeFunc, LongFunction<? extends Object>... funcs) {
|
||||
this.sizeFunc = sizeFunc;
|
||||
public ListHashed(LongFunction<? extends Object>... funcs) {
|
||||
this.valueFuncs = Arrays.asList(funcs);
|
||||
this.size = valueFuncs.size();
|
||||
}
|
||||
@ -47,12 +45,11 @@ public class ListHashed implements LongFunction<List<Object>> {
|
||||
"ListFunctions(NumberNameToString(),NumberNameToString())",
|
||||
"Create a list of ['one','one']"
|
||||
})
|
||||
public ListHashed(LongToIntFunction sizeFunc, LongUnaryOperator... funcs) {
|
||||
public ListHashed(LongUnaryOperator... funcs) {
|
||||
List<LongFunction<?>> building = new ArrayList<>(funcs.length);
|
||||
for (LongUnaryOperator func : funcs) {
|
||||
building.add(func::applyAsLong);
|
||||
}
|
||||
this.sizeFunc = sizeFunc;
|
||||
this.valueFuncs = building;
|
||||
this.size = building.size();
|
||||
}
|
||||
@ -61,12 +58,11 @@ public class ListHashed implements LongFunction<List<Object>> {
|
||||
"ListFunctions(NumberNameToString(),NumberNameToString())",
|
||||
"Create a list of ['one','one']"
|
||||
})
|
||||
public ListHashed(LongToIntFunction sizeFunc, Function<Long,Object>... funcs) {
|
||||
public ListHashed(Function<Long,Object>... funcs) {
|
||||
List<LongFunction<?>> building = new ArrayList<>(funcs.length);
|
||||
for (Function<Long,Object> func : funcs) {
|
||||
building.add(func::apply);
|
||||
}
|
||||
this.sizeFunc = sizeFunc;
|
||||
this.valueFuncs = building;
|
||||
this.size = building.size();
|
||||
}
|
||||
@ -74,7 +70,6 @@ public class ListHashed implements LongFunction<List<Object>> {
|
||||
@Override
|
||||
public List<Object> apply(long value) {
|
||||
long hash = value;
|
||||
int size = sizeFunc.applyAsInt(value);
|
||||
List<Object> list = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
int selector = Math.min(i, valueFuncs.size() - 1);
|
||||
|
@ -28,7 +28,6 @@ import java.util.function.LongUnaryOperator;
|
||||
public class ListSized implements LongFunction<List<Object>> {
|
||||
|
||||
private final List<LongFunction<? extends Object>> valueFuncs;
|
||||
private final int size;
|
||||
private final LongToIntFunction sizeFunc;
|
||||
|
||||
@Example({
|
||||
@ -38,7 +37,6 @@ public class ListSized implements LongFunction<List<Object>> {
|
||||
public ListSized(LongToIntFunction sizeFunc, LongFunction<? extends Object>... funcs) {
|
||||
this.sizeFunc = sizeFunc;
|
||||
this.valueFuncs = Arrays.asList(funcs);
|
||||
this.size = valueFuncs.size();
|
||||
}
|
||||
|
||||
@Example({
|
||||
@ -52,7 +50,6 @@ public class ListSized implements LongFunction<List<Object>> {
|
||||
}
|
||||
this.sizeFunc = sizeFunc;
|
||||
this.valueFuncs = building;
|
||||
this.size = building.size();
|
||||
}
|
||||
|
||||
@Example({
|
||||
@ -66,7 +63,6 @@ public class ListSized implements LongFunction<List<Object>> {
|
||||
}
|
||||
this.sizeFunc = sizeFunc;
|
||||
this.valueFuncs = building;
|
||||
this.size = building.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +29,6 @@ import java.util.function.LongUnaryOperator;
|
||||
public class ListSizedHashed implements LongFunction<List<Object>> {
|
||||
|
||||
private final List<LongFunction<? extends Object>> valueFuncs;
|
||||
private final int size;
|
||||
private final Hash hasher = new Hash();
|
||||
private final LongToIntFunction sizeFunc;
|
||||
|
||||
@ -40,7 +39,6 @@ public class ListSizedHashed implements LongFunction<List<Object>> {
|
||||
public ListSizedHashed(LongToIntFunction sizeFunc, LongFunction<? extends Object>... funcs) {
|
||||
this.sizeFunc = sizeFunc;
|
||||
this.valueFuncs = Arrays.asList(funcs);
|
||||
this.size = valueFuncs.size();
|
||||
}
|
||||
|
||||
@Example({
|
||||
@ -54,7 +52,6 @@ public class ListSizedHashed implements LongFunction<List<Object>> {
|
||||
}
|
||||
this.sizeFunc = sizeFunc;
|
||||
this.valueFuncs = building;
|
||||
this.size = building.size();
|
||||
}
|
||||
|
||||
@Example({
|
||||
@ -68,7 +65,6 @@ public class ListSizedHashed implements LongFunction<List<Object>> {
|
||||
}
|
||||
this.sizeFunc = sizeFunc;
|
||||
this.valueFuncs = building;
|
||||
this.size = building.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +29,6 @@ import java.util.function.LongUnaryOperator;
|
||||
public class ListSizedStepped implements LongFunction<List<Object>> {
|
||||
|
||||
private final List<LongFunction<? extends Object>> valueFuncs;
|
||||
private final int size;
|
||||
private final LongToIntFunction sizeFunc;
|
||||
|
||||
@Example({
|
||||
@ -39,7 +38,6 @@ public class ListSizedStepped implements LongFunction<List<Object>> {
|
||||
public ListSizedStepped(LongToIntFunction sizeFunc, LongFunction<? extends Object>... funcs) {
|
||||
this.sizeFunc = sizeFunc;
|
||||
this.valueFuncs = Arrays.asList(funcs);
|
||||
this.size = valueFuncs.size();
|
||||
}
|
||||
|
||||
@Example({
|
||||
@ -53,7 +51,6 @@ public class ListSizedStepped implements LongFunction<List<Object>> {
|
||||
}
|
||||
this.sizeFunc = sizeFunc;
|
||||
this.valueFuncs = building;
|
||||
this.size = building.size();
|
||||
}
|
||||
|
||||
@Example({
|
||||
@ -67,7 +64,6 @@ public class ListSizedStepped implements LongFunction<List<Object>> {
|
||||
}
|
||||
this.sizeFunc = sizeFunc;
|
||||
this.valueFuncs = building;
|
||||
this.size = building.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,14 +29,12 @@ public class ListStepped implements LongFunction<List<Object>> {
|
||||
|
||||
private final List<LongFunction<? extends Object>> valueFuncs;
|
||||
private final int size;
|
||||
private final LongToIntFunction sizeFunc;
|
||||
|
||||
@Example({
|
||||
"ListFunctions(NumberNameToString(),NumberNameToString())",
|
||||
"Create a list of ['one','one']"
|
||||
})
|
||||
public ListStepped(LongToIntFunction sizeFunc, LongFunction<? extends Object>... funcs) {
|
||||
this.sizeFunc = sizeFunc;
|
||||
public ListStepped(LongFunction<? extends Object>... funcs) {
|
||||
this.valueFuncs = Arrays.asList(funcs);
|
||||
this.size = valueFuncs.size();
|
||||
}
|
||||
@ -45,12 +43,11 @@ public class ListStepped implements LongFunction<List<Object>> {
|
||||
"ListFunctions(NumberNameToString(),NumberNameToString())",
|
||||
"Create a list of ['one','one']"
|
||||
})
|
||||
public ListStepped(LongToIntFunction sizeFunc, LongUnaryOperator... funcs) {
|
||||
public ListStepped(LongUnaryOperator... funcs) {
|
||||
List<LongFunction<?>> building = new ArrayList<>(funcs.length);
|
||||
for (LongUnaryOperator func : funcs) {
|
||||
building.add(func::applyAsLong);
|
||||
}
|
||||
this.sizeFunc = sizeFunc;
|
||||
this.valueFuncs = building;
|
||||
this.size = building.size();
|
||||
}
|
||||
@ -59,19 +56,17 @@ public class ListStepped implements LongFunction<List<Object>> {
|
||||
"ListFunctions(NumberNameToString(),NumberNameToString())",
|
||||
"Create a list of ['one','one']"
|
||||
})
|
||||
public ListStepped(LongToIntFunction sizeFunc, Function<Long,Object>... funcs) {
|
||||
public ListStepped(Function<Long,Object>... funcs) {
|
||||
List<LongFunction<?>> building = new ArrayList<>(funcs.length);
|
||||
for (Function<Long,Object> func : funcs) {
|
||||
building.add(func::apply);
|
||||
}
|
||||
this.sizeFunc = sizeFunc;
|
||||
this.valueFuncs = building;
|
||||
this.size = building.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Object> apply(long value) {
|
||||
int size = sizeFunc.applyAsInt(value);
|
||||
List<Object> list = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
int selector = Math.min(i, valueFuncs.size() - 1);
|
||||
|
Loading…
Reference in New Issue
Block a user