use of io.engineblock.activityapi.input.InputType in project engineblock by engineblock.
the class CoreServices method getInputDispenser.
// public static <A extends Activity> Optional<IntPredicateDispenser> getResultFilterDispenser(A activity) {
// Optional<IntPredicateDispenser> intPredicateDispenser = new SimpleConfig(activity, "resultfilter")
// .getString("type")
// .flatMap(ExperimentalResultFilterType.FINDER::get)
// .map(rft -> rft.getFilterDispenser(activity));
// return intPredicateDispenser;
// }
//
public static <A extends Activity> InputDispenser getInputDispenser(A activity) {
String inputTypeName = new SimpleConfig(activity, "input").getString("type").orElse("targetrate");
InputType inputType = InputType.FINDER.getOrThrow(inputTypeName);
InputDispenser dispenser = inputType.getInputDispenser(activity);
Optional<Predicate<ResultReadable>> inputFilterDispenser = getInputFilter(activity);
if (inputFilterDispenser.isPresent()) {
dispenser = new FilteringInputDispenser(dispenser, inputFilterDispenser.get());
}
return dispenser;
}
use of io.engineblock.activityapi.input.InputType in project engineblock by engineblock.
the class CoreInputDispenser method createInput.
private synchronized Input createInput(long slot) {
SimpleConfig conf = new SimpleConfig(activity, "input");
String inputType = conf.getString("type").orElse("targetrate");
InputType inputTypeImpl = InputType.FINDER.getOrThrow(inputType);
InputDispenser inputDispenser = inputTypeImpl.getInputDispenser(activity);
if (inputDispenser instanceof ActivitiesAware) {
((ActivitiesAware) inputDispenser).setActivitiesMap(activities);
}
Input input = inputDispenser.getInput(slot);
return input;
}
Aggregations