Search in sources :

Example 11 with IntPredicate

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);
}
Also used : IntPredicate(java.util.function.IntPredicate)

Example 12 with IntPredicate

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()));
}
Also used : IntStream(java.util.stream.IntStream) List(java.util.List) IntToDoubleFunction(java.util.function.IntToDoubleFunction) Assert(org.testng.Assert) DataProvider(org.testng.annotations.DataProvider) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) IntUnaryOperator(java.util.function.IntUnaryOperator) Test(org.testng.annotations.Test) IntPredicate(java.util.function.IntPredicate) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) IntPredicate(java.util.function.IntPredicate) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 13 with IntPredicate

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;
}
Also used : Input(io.engineblock.activityapi.input.Input) IntPredicate(java.util.function.IntPredicate) Output(io.engineblock.activityapi.output.Output)

Aggregations

IntPredicate (java.util.function.IntPredicate)13 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)5 TestCase (junit.framework.TestCase)5 Test (org.testng.annotations.Test)3 List (java.util.List)2 IntStream (java.util.stream.IntStream)2 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)2 RollbackException (com.torodb.core.transaction.RollbackException)1 Input (io.engineblock.activityapi.input.Input)1 Output (io.engineblock.activityapi.output.Output)1 IOException (java.io.IOException)1 Math.exp (java.lang.Math.exp)1 Math.log10 (java.lang.Math.log10)1 String.format (java.lang.String.format)1 java.util (java.util)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1