org.optaplanner.constraint.streams.bavet.bi.AbstractGroupBiNode Maven / Gradle / Ivy
package org.optaplanner.constraint.streams.bavet.bi;
import java.util.function.Function;
import org.optaplanner.constraint.streams.bavet.common.AbstractGroupNode;
import org.optaplanner.constraint.streams.bavet.common.Tuple;
import org.optaplanner.constraint.streams.bavet.common.TupleLifecycle;
import org.optaplanner.core.api.function.TriFunction;
import org.optaplanner.core.api.score.stream.bi.BiConstraintCollector;
abstract class AbstractGroupBiNode
extends AbstractGroupNode, OutTuple_, MutableOutTuple_, GroupKey_, ResultContainer_, Result_> {
private final TriFunction accumulator;
protected AbstractGroupBiNode(int groupStoreIndex,
Function, GroupKey_> groupKeyFunction,
BiConstraintCollector collector,
TupleLifecycle nextNodesTupleLifecycle) {
super(groupStoreIndex, groupKeyFunction,
collector == null ? null : collector.supplier(),
collector == null ? null : collector.finisher(),
nextNodesTupleLifecycle);
accumulator = collector == null ? null : collector.accumulator();
}
@Override
protected final Runnable accumulate(ResultContainer_ resultContainer, BiTuple tuple) {
return accumulator.apply(resultContainer, tuple.getFactA(), tuple.getFactB());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy