org.optaplanner.constraint.streams.bavet.quad.IfExistsQuadWithUniNode Maven / Gradle / Ivy
package org.optaplanner.constraint.streams.bavet.quad;
import java.util.Set;
import java.util.function.Function;
import org.optaplanner.constraint.streams.bavet.common.AbstractIfExistsNode;
import org.optaplanner.constraint.streams.bavet.common.TupleLifecycle;
import org.optaplanner.constraint.streams.bavet.common.index.IndexProperties;
import org.optaplanner.constraint.streams.bavet.common.index.Indexer;
import org.optaplanner.constraint.streams.bavet.uni.UniTuple;
import org.optaplanner.core.api.function.PentaPredicate;
import org.optaplanner.core.api.function.QuadFunction;
final class IfExistsQuadWithUniNode extends AbstractIfExistsNode, E> {
private final QuadFunction mappingABCD;
private final PentaPredicate filtering;
public IfExistsQuadWithUniNode(boolean shouldExist,
QuadFunction mappingABCD, Function mappingD,
int inputStoreIndexABC, int inputStoreIndexD,
TupleLifecycle> nextNodesTupleLifecycle,
Indexer, Counter>> indexerABCD,
Indexer, Set>>> indexerE,
PentaPredicate filtering) {
super(shouldExist, mappingD, inputStoreIndexABC, inputStoreIndexD, nextNodesTupleLifecycle, indexerABCD, indexerE);
this.mappingABCD = mappingABCD;
this.filtering = filtering;
}
@Override
protected IndexProperties createIndexProperties(QuadTuple leftTuple) {
return mappingABCD.apply(leftTuple.getFactA(), leftTuple.getFactB(), leftTuple.getFactC(), leftTuple.getFactD());
}
@Override
protected boolean isFiltering() {
return filtering != null;
}
@Override
protected boolean isFiltered(QuadTuple leftTuple, UniTuple rightTuple) {
return filtering.test(leftTuple.getFactA(), leftTuple.getFactB(), leftTuple.getFactC(), leftTuple.getFactD(),
rightTuple.getFactA());
}
@Override
public String toString() {
return "IfExistsQuadWithUniNode";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy