List of usage examples for java.util.function ToIntFunction applyAsInt
int applyAsInt(T value);
From source file:sadl.models.TauPTA.java
private void insertPerLevelAnomaly(IntFunction<List<Transition>> possibleTransitionFunction, ToIntFunction<List<Transition>> insertAnomaly) { for (int height = 0; height < getTreeHeight(); height++) { final TIntList states = getStates(height); final List<Transition> allLevelTransitions = new ArrayList<>(); for (int i = 0; i < states.size(); i++) { allLevelTransitions.addAll(getOutTransitions(states.get(i), true)); }//from w ww .j av a 2 s .c om int result = 0; final List<Transition> possibleTransitions = possibleTransitionFunction.apply(height); if (possibleTransitions.size() > 0) { // sort for determinism Collections.sort(possibleTransitions); result = insertAnomaly.applyAsInt(possibleTransitions); } if (possibleTransitions.size() == 0 || result != 1) { logger.warn("It is not possible to insert anomalies on height {}", height); } } }