use of java.util.function.IntPredicate in project VocabHunter by VocabHunter.
the class WordListHandler method findClosestWord.
private WordModel findClosestWord(final int current, final boolean isEditable, final WordFilter filter) {
IntPredicate test;
if (isEditable) {
test = i -> isShown(filter, sessionModel.getWord(i));
} else {
test = sessionModel::isSelected;
}
int index = IndexTool.findClosest(current, sessionModel.getAllWordsSize(), test);
return sessionModel.getWord(index);
}
use of java.util.function.IntPredicate in project gatk by broadinstitute.
the class IndexRangeUnitTest method testFilter.
@Test(dataProvider = "correctFromToData", dependsOnMethods = "testCorrectConstruction")
public void testFilter(final int from, final int to) {
final IndexRange range = new IndexRange(from, to);
final IntPredicate pred = n -> Math.sin(n) < 0.4;
Assert.assertEquals(range.filter(pred), IntStream.range(from, to).filter(pred).boxed().collect(Collectors.toList()));
}
use of java.util.function.IntPredicate in project engineblock by engineblock.
the class CoreMotorDispenser method getMotor.
@Override
public Motor getMotor(ActivityDef activityDef, int slotId) {
Action action = actionDispenser.getAction(slotId);
Input input = inputDispenser.getInput(slotId);
Output output = null;
if (outputDispenser != null) {
output = outputDispenser.getOutput(slotId);
}
IntPredicate resultFilter = null;
Motor am = new CoreMotor(activity, slotId, input, action, output);
return am;
}
Aggregations