diff --git a/core/src/main/java/ai/timefold/solver/core/api/score/stream/Joiners.java b/core/src/main/java/ai/timefold/solver/core/api/score/stream/Joiners.java index 72b737efbf..6f7183ef3d 100644 --- a/core/src/main/java/ai/timefold/solver/core/api/score/stream/Joiners.java +++ b/core/src/main/java/ai/timefold/solver/core/api/score/stream/Joiners.java @@ -15,15 +15,15 @@ import ai.timefold.solver.core.api.score.stream.quad.QuadJoiner; import ai.timefold.solver.core.api.score.stream.tri.TriJoiner; import ai.timefold.solver.core.api.score.stream.uni.UniConstraintStream; -import ai.timefold.solver.core.impl.score.stream.JoinerType; -import ai.timefold.solver.core.impl.score.stream.common.bi.DefaultBiJoiner; -import ai.timefold.solver.core.impl.score.stream.common.bi.FilteringBiJoiner; -import ai.timefold.solver.core.impl.score.stream.common.penta.DefaultPentaJoiner; -import ai.timefold.solver.core.impl.score.stream.common.penta.FilteringPentaJoiner; -import ai.timefold.solver.core.impl.score.stream.common.quad.DefaultQuadJoiner; -import ai.timefold.solver.core.impl.score.stream.common.quad.FilteringQuadJoiner; -import ai.timefold.solver.core.impl.score.stream.common.tri.DefaultTriJoiner; -import ai.timefold.solver.core.impl.score.stream.common.tri.FilteringTriJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.DefaultBiJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.DefaultPentaJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.DefaultQuadJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.DefaultTriJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.FilteringBiJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.FilteringPentaJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.FilteringQuadJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.FilteringTriJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.JoinerType; import ai.timefold.solver.core.impl.util.ConstantLambdaUtils; import org.jspecify.annotations.NonNull; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/bavet/AbstractSession.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/AbstractSession.java new file mode 100644 index 0000000000..a0eac1c62a --- /dev/null +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/AbstractSession.java @@ -0,0 +1,56 @@ +package ai.timefold.solver.core.impl.bavet; + +import java.util.IdentityHashMap; +import java.util.Map; + +import ai.timefold.solver.core.impl.bavet.uni.AbstractForEachUniNode; + +public abstract class AbstractSession { + + private final NodeNetwork nodeNetwork; + private final Map, AbstractForEachUniNode[]> effectiveClassToNodeArrayMap; + + protected AbstractSession(NodeNetwork nodeNetwork) { + this.nodeNetwork = nodeNetwork; + this.effectiveClassToNodeArrayMap = new IdentityHashMap<>(nodeNetwork.forEachNodeCount()); + } + + public final void insert(Object fact) { + var factClass = fact.getClass(); + for (var node : findNodes(factClass)) { + node.insert(fact); + } + } + + @SuppressWarnings("unchecked") + private AbstractForEachUniNode[] findNodes(Class factClass) { + // Map.computeIfAbsent() would have created lambdas on the hot path, this will not. + var nodeArray = effectiveClassToNodeArrayMap.get(factClass); + if (nodeArray == null) { + nodeArray = nodeNetwork.getForEachNodes(factClass) + .filter(AbstractForEachUniNode::supportsIndividualUpdates) + .toArray(AbstractForEachUniNode[]::new); + effectiveClassToNodeArrayMap.put(factClass, nodeArray); + } + return nodeArray; + } + + public final void update(Object fact) { + var factClass = fact.getClass(); + for (var node : findNodes(factClass)) { + node.update(fact); + } + } + + public final void retract(Object fact) { + var factClass = fact.getClass(); + for (var node : findNodes(factClass)) { + node.retract(fact); + } + } + + protected void settle() { + nodeNetwork.settle(); + } + +} diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/NodeNetwork.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/NodeNetwork.java similarity index 73% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/NodeNetwork.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/NodeNetwork.java index 83511b5ecf..63fec53a90 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/NodeNetwork.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/NodeNetwork.java @@ -1,12 +1,13 @@ -package ai.timefold.solver.core.impl.score.stream.bavet; +package ai.timefold.solver.core.impl.bavet; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.stream.Stream; -import ai.timefold.solver.core.impl.score.stream.bavet.common.Propagator; -import ai.timefold.solver.core.impl.score.stream.bavet.uni.AbstractForEachUniNode; +import ai.timefold.solver.core.impl.bavet.common.Propagator; +import ai.timefold.solver.core.impl.bavet.uni.AbstractForEachUniNode; /** * Represents Bavet's network of nodes, specific to a particular session. @@ -17,7 +18,7 @@ * @param layeredNodes nodes grouped first by their layer, then by their index within the layer; * propagation needs to happen in this order. */ -record NodeNetwork(Map, List>> declaredClassToNodeMap, Propagator[][] layeredNodes) { +public record NodeNetwork(Map, List>> declaredClassToNodeMap, Propagator[][] layeredNodes) { public static final NodeNetwork EMPTY = new NodeNetwork(Map.of(), new Propagator[0][0]); @@ -29,23 +30,27 @@ public int layerCount() { return layeredNodes.length; } - @SuppressWarnings("unchecked") - public AbstractForEachUniNode[] getApplicableForEachNodes(Class factClass) { + public Stream> getForEachNodes() { + return declaredClassToNodeMap.values() + .stream() + .flatMap(List::stream); + } + + public Stream> getForEachNodes(Class factClass) { return declaredClassToNodeMap.entrySet() .stream() .filter(entry -> entry.getKey().isAssignableFrom(factClass)) .map(Map.Entry::getValue) - .flatMap(List::stream) - .toArray(AbstractForEachUniNode[]::new); + .flatMap(List::stream); } - public void propagate() { + public void settle() { for (var layerIndex = 0; layerIndex < layerCount(); layerIndex++) { - propagateInLayer(layeredNodes[layerIndex]); + settleLayer(layeredNodes[layerIndex]); } } - private static void propagateInLayer(Propagator[] nodesInLayer) { + private static void settleLayer(Propagator[] nodesInLayer) { var nodeCount = nodesInLayer.length; if (nodeCount == 1) { nodesInLayer[0].propagateEverything(); diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/AbstractGroupBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/AbstractGroupBiNode.java similarity index 82% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/AbstractGroupBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/AbstractGroupBiNode.java index 974e4959ac..425fba808c 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/AbstractGroupBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/AbstractGroupBiNode.java @@ -1,14 +1,14 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.function.Function; import ai.timefold.solver.core.api.function.TriFunction; import ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.AbstractGroupNode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.AbstractGroupNode; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; abstract class AbstractGroupBiNode extends AbstractGroupNode, OutTuple_, GroupKey_, ResultContainer_, Result_> { diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/ConcatBiBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/ConcatBiBiNode.java similarity index 72% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/ConcatBiBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/ConcatBiBiNode.java index d885bc9bbe..27dcbaf79a 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/ConcatBiBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/ConcatBiBiNode.java @@ -1,13 +1,13 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; -import ai.timefold.solver.core.impl.score.stream.bavet.common.AbstractConcatNode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.AbstractConcatNode; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; -final class ConcatBiBiNode +public final class ConcatBiBiNode extends AbstractConcatNode, BiTuple, BiTuple> { - ConcatBiBiNode(TupleLifecycle> nextNodesTupleLifecycle, + public ConcatBiBiNode(TupleLifecycle> nextNodesTupleLifecycle, int inputStoreIndexLeftOutTupleList, int inputStoreIndexRightOutTupleList, int outputStoreSize) { super(nextNodesTupleLifecycle, inputStoreIndexLeftOutTupleList, inputStoreIndexRightOutTupleList, outputStoreSize); diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/ConcatBiUniNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/ConcatBiUniNode.java similarity index 70% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/ConcatBiUniNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/ConcatBiUniNode.java index ced700f1f7..02e37019c0 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/ConcatBiUniNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/ConcatBiUniNode.java @@ -1,18 +1,18 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.function.Function; -import ai.timefold.solver.core.impl.score.stream.bavet.common.AbstractConcatNode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; +import ai.timefold.solver.core.impl.bavet.common.AbstractConcatNode; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; -final class ConcatBiUniNode +public final class ConcatBiUniNode extends AbstractConcatNode, UniTuple, BiTuple> { private final Function paddingFunction; - ConcatBiUniNode(Function paddingFunction, TupleLifecycle> nextNodesTupleLifecycle, + public ConcatBiUniNode(Function paddingFunction, TupleLifecycle> nextNodesTupleLifecycle, int inputStoreIndexLeftOutTupleList, int inputStoreIndexRightOutTupleList, int outputStoreSize) { super(nextNodesTupleLifecycle, inputStoreIndexLeftOutTupleList, inputStoreIndexRightOutTupleList, outputStoreSize); diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/ConcatUniBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/ConcatUniBiNode.java similarity index 70% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/ConcatUniBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/ConcatUniBiNode.java index b36377bf25..700ad1c2cc 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/ConcatUniBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/ConcatUniBiNode.java @@ -1,18 +1,18 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.function.Function; -import ai.timefold.solver.core.impl.score.stream.bavet.common.AbstractConcatNode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; +import ai.timefold.solver.core.impl.bavet.common.AbstractConcatNode; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; -final class ConcatUniBiNode +public final class ConcatUniBiNode extends AbstractConcatNode, BiTuple, BiTuple> { private final Function paddingFunction; - ConcatUniBiNode(Function paddingFunction, TupleLifecycle> nextNodesTupleLifecycle, + public ConcatUniBiNode(Function paddingFunction, TupleLifecycle> nextNodesTupleLifecycle, int inputStoreIndexLeftOutTupleList, int inputStoreIndexRightOutTupleList, int outputStoreSize) { super(nextNodesTupleLifecycle, inputStoreIndexLeftOutTupleList, inputStoreIndexRightOutTupleList, diff --git a/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/ConditionalBiTupleLifecycle.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/ConditionalBiTupleLifecycle.java new file mode 100644 index 0000000000..0c29475c44 --- /dev/null +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/ConditionalBiTupleLifecycle.java @@ -0,0 +1,22 @@ +package ai.timefold.solver.core.impl.bavet.bi; + +import java.util.function.BiPredicate; + +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractConditionalTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; + +public final class ConditionalBiTupleLifecycle extends AbstractConditionalTupleLifecycle> { + private final BiPredicate predicate; + + public ConditionalBiTupleLifecycle(BiPredicate predicate, TupleLifecycle> tupleLifecycle) { + super(tupleLifecycle); + this.predicate = predicate; + } + + @Override + protected boolean test(BiTuple tuple) { + return predicate.test(tuple.factA, tuple.factB); + } + +} diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/FlattenLastBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/FlattenLastBiNode.java similarity index 57% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/FlattenLastBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/FlattenLastBiNode.java index 412fa6ed17..a6a18c6667 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/FlattenLastBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/FlattenLastBiNode.java @@ -1,16 +1,16 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.function.Function; -import ai.timefold.solver.core.impl.score.stream.bavet.common.AbstractFlattenLastNode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.AbstractFlattenLastNode; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; -final class FlattenLastBiNode extends AbstractFlattenLastNode, BiTuple, B, NewB> { +public final class FlattenLastBiNode extends AbstractFlattenLastNode, BiTuple, B, NewB> { private final int outputStoreSize; - FlattenLastBiNode(int flattenLastStoreIndex, Function> mappingFunction, + public FlattenLastBiNode(int flattenLastStoreIndex, Function> mappingFunction, TupleLifecycle> nextNodesTupleLifecycle, int outputStoreSize) { super(flattenLastStoreIndex, mappingFunction, nextNodesTupleLifecycle); this.outputStoreSize = outputStoreSize; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group0Mapping1CollectorBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group0Mapping1CollectorBiNode.java similarity index 76% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group0Mapping1CollectorBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group0Mapping1CollectorBiNode.java index dcfb799ddf..2fff40a8e1 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group0Mapping1CollectorBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group0Mapping1CollectorBiNode.java @@ -1,11 +1,11 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; -final class Group0Mapping1CollectorBiNode +public final class Group0Mapping1CollectorBiNode extends AbstractGroupBiNode, Void, ResultContainer_, A> { private final int outputStoreSize; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group0Mapping2CollectorBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group0Mapping2CollectorBiNode.java similarity index 84% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group0Mapping2CollectorBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group0Mapping2CollectorBiNode.java index fd9a12fea7..28493700fa 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group0Mapping2CollectorBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group0Mapping2CollectorBiNode.java @@ -1,13 +1,13 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import ai.timefold.solver.core.api.score.stream.ConstraintCollectors; import ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; import ai.timefold.solver.core.impl.util.Pair; -final class Group0Mapping2CollectorBiNode +public final class Group0Mapping2CollectorBiNode extends AbstractGroupBiNode, Void, Object, Pair> { private final int outputStoreSize; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group0Mapping3CollectorBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group0Mapping3CollectorBiNode.java similarity index 85% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group0Mapping3CollectorBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group0Mapping3CollectorBiNode.java index d0f6ea2cce..4c2e3d86fd 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group0Mapping3CollectorBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group0Mapping3CollectorBiNode.java @@ -1,13 +1,13 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import ai.timefold.solver.core.api.score.stream.ConstraintCollectors; import ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TriTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TriTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; import ai.timefold.solver.core.impl.util.Triple; -final class Group0Mapping3CollectorBiNode +public final class Group0Mapping3CollectorBiNode extends AbstractGroupBiNode, Void, Object, Triple> { private final int outputStoreSize; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group0Mapping4CollectorBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group0Mapping4CollectorBiNode.java similarity index 86% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group0Mapping4CollectorBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group0Mapping4CollectorBiNode.java index a4dcea39dd..8d369e2f6c 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group0Mapping4CollectorBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group0Mapping4CollectorBiNode.java @@ -1,13 +1,13 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import ai.timefold.solver.core.api.score.stream.ConstraintCollectors; import ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.QuadTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.QuadTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; import ai.timefold.solver.core.impl.util.Quadruple; -final class Group0Mapping4CollectorBiNode +public final class Group0Mapping4CollectorBiNode extends AbstractGroupBiNode, Void, Object, Quadruple> { diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group1Mapping0CollectorBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group1Mapping0CollectorBiNode.java similarity index 76% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group1Mapping0CollectorBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group1Mapping0CollectorBiNode.java index 2aebf6017a..8da5045ac1 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group1Mapping0CollectorBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group1Mapping0CollectorBiNode.java @@ -1,13 +1,13 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.function.BiFunction; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; -final class Group1Mapping0CollectorBiNode +public final class Group1Mapping0CollectorBiNode extends AbstractGroupBiNode, A, Void, Void> { private final int outputStoreSize; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group1Mapping1CollectorBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group1Mapping1CollectorBiNode.java similarity index 73% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group1Mapping1CollectorBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group1Mapping1CollectorBiNode.java index 181471360f..17f13c6e3c 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group1Mapping1CollectorBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group1Mapping1CollectorBiNode.java @@ -1,15 +1,15 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; -import static ai.timefold.solver.core.impl.score.stream.bavet.bi.Group1Mapping0CollectorBiNode.createGroupKey; +import static ai.timefold.solver.core.impl.bavet.bi.Group1Mapping0CollectorBiNode.createGroupKey; import java.util.function.BiFunction; import ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; -final class Group1Mapping1CollectorBiNode +public final class Group1Mapping1CollectorBiNode extends AbstractGroupBiNode, A, ResultContainer_, B> { private final int outputStoreSize; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group1Mapping2CollectorBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group1Mapping2CollectorBiNode.java similarity index 76% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group1Mapping2CollectorBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group1Mapping2CollectorBiNode.java index 0f7a558993..8a95f69eb2 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group1Mapping2CollectorBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group1Mapping2CollectorBiNode.java @@ -1,16 +1,16 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; -import static ai.timefold.solver.core.impl.score.stream.bavet.bi.Group1Mapping0CollectorBiNode.createGroupKey; +import static ai.timefold.solver.core.impl.bavet.bi.Group1Mapping0CollectorBiNode.createGroupKey; import java.util.function.BiFunction; import ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TriTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TriTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; import ai.timefold.solver.core.impl.util.Pair; -final class Group1Mapping2CollectorBiNode +public final class Group1Mapping2CollectorBiNode extends AbstractGroupBiNode, A, Object, Pair> { private final int outputStoreSize; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group1Mapping3CollectorBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group1Mapping3CollectorBiNode.java similarity index 73% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group1Mapping3CollectorBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group1Mapping3CollectorBiNode.java index 3850eae451..62f5ae9b64 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group1Mapping3CollectorBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group1Mapping3CollectorBiNode.java @@ -1,17 +1,17 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; -import static ai.timefold.solver.core.impl.score.stream.bavet.bi.Group0Mapping3CollectorBiNode.mergeCollectors; -import static ai.timefold.solver.core.impl.score.stream.bavet.bi.Group1Mapping0CollectorBiNode.createGroupKey; +import static ai.timefold.solver.core.impl.bavet.bi.Group0Mapping3CollectorBiNode.mergeCollectors; +import static ai.timefold.solver.core.impl.bavet.bi.Group1Mapping0CollectorBiNode.createGroupKey; import java.util.function.BiFunction; import ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.QuadTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.QuadTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; import ai.timefold.solver.core.impl.util.Triple; -final class Group1Mapping3CollectorBiNode +public final class Group1Mapping3CollectorBiNode extends AbstractGroupBiNode, A, Object, Triple> { private final int outputStoreSize; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group2Mapping0CollectorBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group2Mapping0CollectorBiNode.java similarity index 84% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group2Mapping0CollectorBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group2Mapping0CollectorBiNode.java index 8ee27566f2..f567f84639 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group2Mapping0CollectorBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group2Mapping0CollectorBiNode.java @@ -1,13 +1,13 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.function.BiFunction; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; import ai.timefold.solver.core.impl.util.Pair; -final class Group2Mapping0CollectorBiNode +public final class Group2Mapping0CollectorBiNode extends AbstractGroupBiNode, Pair, Void, Void> { private final int outputStoreSize; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group2Mapping1CollectorBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group2Mapping1CollectorBiNode.java similarity index 81% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group2Mapping1CollectorBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group2Mapping1CollectorBiNode.java index d47d6819c7..d18b55c937 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group2Mapping1CollectorBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group2Mapping1CollectorBiNode.java @@ -1,14 +1,14 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.function.BiFunction; import ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TriTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TriTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; import ai.timefold.solver.core.impl.util.Pair; -final class Group2Mapping1CollectorBiNode +public final class Group2Mapping1CollectorBiNode extends AbstractGroupBiNode, Pair, ResultContainer_, C> { private final int outputStoreSize; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group2Mapping2CollectorBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group2Mapping2CollectorBiNode.java similarity index 83% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group2Mapping2CollectorBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group2Mapping2CollectorBiNode.java index 5ee56b9925..0d07488ce4 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group2Mapping2CollectorBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group2Mapping2CollectorBiNode.java @@ -1,14 +1,14 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.function.BiFunction; import ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.QuadTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.QuadTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; import ai.timefold.solver.core.impl.util.Pair; -final class Group2Mapping2CollectorBiNode +public final class Group2Mapping2CollectorBiNode extends AbstractGroupBiNode, Pair, Object, Pair> { diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group3Mapping0CollectorBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group3Mapping0CollectorBiNode.java similarity index 82% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group3Mapping0CollectorBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group3Mapping0CollectorBiNode.java index 306cfc077e..ea313a7dd0 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group3Mapping0CollectorBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group3Mapping0CollectorBiNode.java @@ -1,14 +1,14 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.function.BiFunction; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TriTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TriTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; import ai.timefold.solver.core.impl.util.Triple; -final class Group3Mapping0CollectorBiNode +public final class Group3Mapping0CollectorBiNode extends AbstractGroupBiNode, Triple, Void, Void> { private final int outputStoreSize; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group3Mapping1CollectorBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group3Mapping1CollectorBiNode.java similarity index 83% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group3Mapping1CollectorBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group3Mapping1CollectorBiNode.java index e5fbf370dc..3d768ee557 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group3Mapping1CollectorBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group3Mapping1CollectorBiNode.java @@ -1,14 +1,14 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.function.BiFunction; import ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.QuadTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.QuadTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; import ai.timefold.solver.core.impl.util.Triple; -final class Group3Mapping1CollectorBiNode +public final class Group3Mapping1CollectorBiNode extends AbstractGroupBiNode, Triple, ResultContainer_, D> { diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group4Mapping0CollectorBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group4Mapping0CollectorBiNode.java similarity index 84% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group4Mapping0CollectorBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group4Mapping0CollectorBiNode.java index 76dafa42b2..7220bdacd9 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/Group4Mapping0CollectorBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/Group4Mapping0CollectorBiNode.java @@ -1,14 +1,14 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.function.BiFunction; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.QuadTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.QuadTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; import ai.timefold.solver.core.impl.util.Quadruple; -final class Group4Mapping0CollectorBiNode +public final class Group4Mapping0CollectorBiNode extends AbstractGroupBiNode, Quadruple, Void, Void> { diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/IndexedIfExistsBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/IndexedIfExistsBiNode.java similarity index 76% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/IndexedIfExistsBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/IndexedIfExistsBiNode.java index 5a6fcff1d2..1cdcc2a14f 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/IndexedIfExistsBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/IndexedIfExistsBiNode.java @@ -1,18 +1,18 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.function.BiFunction; import java.util.function.Function; import ai.timefold.solver.core.api.function.TriPredicate; -import ai.timefold.solver.core.impl.score.stream.bavet.common.AbstractIndexedIfExistsNode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.ExistsCounter; -import ai.timefold.solver.core.impl.score.stream.bavet.common.index.IndexProperties; -import ai.timefold.solver.core.impl.score.stream.bavet.common.index.Indexer; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; - -final class IndexedIfExistsBiNode extends AbstractIndexedIfExistsNode, C> { +import ai.timefold.solver.core.impl.bavet.common.AbstractIndexedIfExistsNode; +import ai.timefold.solver.core.impl.bavet.common.ExistsCounter; +import ai.timefold.solver.core.impl.bavet.common.index.IndexProperties; +import ai.timefold.solver.core.impl.bavet.common.index.Indexer; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; + +public final class IndexedIfExistsBiNode extends AbstractIndexedIfExistsNode, C> { private final BiFunction mappingAB; private final TriPredicate filtering; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/IndexedJoinBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/IndexedJoinBiNode.java similarity index 76% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/IndexedJoinBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/IndexedJoinBiNode.java index c3916cbfe8..7050b0a182 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/IndexedJoinBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/IndexedJoinBiNode.java @@ -1,16 +1,16 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.function.BiPredicate; import java.util.function.Function; -import ai.timefold.solver.core.impl.score.stream.bavet.common.AbstractIndexedJoinNode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.index.IndexProperties; -import ai.timefold.solver.core.impl.score.stream.bavet.common.index.Indexer; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; +import ai.timefold.solver.core.impl.bavet.common.AbstractIndexedJoinNode; +import ai.timefold.solver.core.impl.bavet.common.index.IndexProperties; +import ai.timefold.solver.core.impl.bavet.common.index.Indexer; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; -final class IndexedJoinBiNode extends AbstractIndexedJoinNode, B, BiTuple> { +public final class IndexedJoinBiNode extends AbstractIndexedJoinNode, B, BiTuple> { private final Function mappingA; private final BiPredicate filtering; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/MapBiToBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/MapBiToBiNode.java similarity index 69% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/MapBiToBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/MapBiToBiNode.java index afb24481f1..63bf37bfc6 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/MapBiToBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/MapBiToBiNode.java @@ -1,18 +1,18 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.Objects; import java.util.function.BiFunction; -import ai.timefold.solver.core.impl.score.stream.bavet.common.AbstractMapNode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.AbstractMapNode; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; -final class MapBiToBiNode extends AbstractMapNode, BiTuple> { +public final class MapBiToBiNode extends AbstractMapNode, BiTuple> { private final BiFunction mappingFunctionA; private final BiFunction mappingFunctionB; - MapBiToBiNode(int mapStoreIndex, BiFunction mappingFunctionA, BiFunction mappingFunctionB, + public MapBiToBiNode(int mapStoreIndex, BiFunction mappingFunctionA, BiFunction mappingFunctionB, TupleLifecycle> nextNodesTupleLifecycle, int outputStoreSize) { super(mapStoreIndex, nextNodesTupleLifecycle, outputStoreSize); this.mappingFunctionA = Objects.requireNonNull(mappingFunctionA); diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/MapBiToQuadNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/MapBiToQuadNode.java similarity index 77% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/MapBiToQuadNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/MapBiToQuadNode.java index 28d12ab08a..42e314f411 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/MapBiToQuadNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/MapBiToQuadNode.java @@ -1,14 +1,14 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.Objects; import java.util.function.BiFunction; -import ai.timefold.solver.core.impl.score.stream.bavet.common.AbstractMapNode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.QuadTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.AbstractMapNode; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.QuadTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; -final class MapBiToQuadNode +public final class MapBiToQuadNode extends AbstractMapNode, QuadTuple> { private final BiFunction mappingFunctionA; @@ -16,7 +16,7 @@ final class MapBiToQuadNode private final BiFunction mappingFunctionC; private final BiFunction mappingFunctionD; - MapBiToQuadNode(int mapStoreIndex, BiFunction mappingFunctionA, BiFunction mappingFunctionB, + public MapBiToQuadNode(int mapStoreIndex, BiFunction mappingFunctionA, BiFunction mappingFunctionB, BiFunction mappingFunctionC, BiFunction mappingFunctionD, TupleLifecycle> nextNodesTupleLifecycle, int outputStoreSize) { super(mapStoreIndex, nextNodesTupleLifecycle, outputStoreSize); diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/MapBiToTriNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/MapBiToTriNode.java similarity index 71% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/MapBiToTriNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/MapBiToTriNode.java index 01519f102f..e745fd8338 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/MapBiToTriNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/MapBiToTriNode.java @@ -1,20 +1,20 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.Objects; import java.util.function.BiFunction; -import ai.timefold.solver.core.impl.score.stream.bavet.common.AbstractMapNode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TriTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.AbstractMapNode; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TriTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; -final class MapBiToTriNode extends AbstractMapNode, TriTuple> { +public final class MapBiToTriNode extends AbstractMapNode, TriTuple> { private final BiFunction mappingFunctionA; private final BiFunction mappingFunctionB; private final BiFunction mappingFunctionC; - MapBiToTriNode(int mapStoreIndex, BiFunction mappingFunctionA, BiFunction mappingFunctionB, + public MapBiToTriNode(int mapStoreIndex, BiFunction mappingFunctionA, BiFunction mappingFunctionB, BiFunction mappingFunctionC, TupleLifecycle> nextNodesTupleLifecycle, int outputStoreSize) { super(mapStoreIndex, nextNodesTupleLifecycle, outputStoreSize); diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/MapBiToUniNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/MapBiToUniNode.java similarity index 61% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/MapBiToUniNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/MapBiToUniNode.java index 7254443bd6..1462b7ce36 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/MapBiToUniNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/MapBiToUniNode.java @@ -1,18 +1,18 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.Objects; import java.util.function.BiFunction; -import ai.timefold.solver.core.impl.score.stream.bavet.common.AbstractMapNode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; +import ai.timefold.solver.core.impl.bavet.common.AbstractMapNode; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; -final class MapBiToUniNode extends AbstractMapNode, UniTuple> { +public final class MapBiToUniNode extends AbstractMapNode, UniTuple> { private final BiFunction mappingFunction; - MapBiToUniNode(int mapStoreIndex, BiFunction mappingFunction, + public MapBiToUniNode(int mapStoreIndex, BiFunction mappingFunction, TupleLifecycle> nextNodesTupleLifecycle, int outputStoreSize) { super(mapStoreIndex, nextNodesTupleLifecycle, outputStoreSize); this.mappingFunction = Objects.requireNonNull(mappingFunction); diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/UnindexedIfExistsBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/UnindexedIfExistsBiNode.java similarity index 72% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/UnindexedIfExistsBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/UnindexedIfExistsBiNode.java index 56266da801..7316766738 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/UnindexedIfExistsBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/UnindexedIfExistsBiNode.java @@ -1,12 +1,12 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import ai.timefold.solver.core.api.function.TriPredicate; -import ai.timefold.solver.core.impl.score.stream.bavet.common.AbstractUnindexedIfExistsNode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; +import ai.timefold.solver.core.impl.bavet.common.AbstractUnindexedIfExistsNode; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; -final class UnindexedIfExistsBiNode extends AbstractUnindexedIfExistsNode, C> { +public final class UnindexedIfExistsBiNode extends AbstractUnindexedIfExistsNode, C> { private final TriPredicate filtering; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/UnindexedJoinBiNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/UnindexedJoinBiNode.java similarity index 79% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/UnindexedJoinBiNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/UnindexedJoinBiNode.java index 1e572325d6..ebd0cd9c72 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/bi/UnindexedJoinBiNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/bi/UnindexedJoinBiNode.java @@ -1,13 +1,13 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.bi; +package ai.timefold.solver.core.impl.bavet.bi; import java.util.function.BiPredicate; -import ai.timefold.solver.core.impl.score.stream.bavet.common.AbstractUnindexedJoinNode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; +import ai.timefold.solver.core.impl.bavet.common.AbstractUnindexedJoinNode; +import ai.timefold.solver.core.impl.bavet.common.tuple.BiTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; -final class UnindexedJoinBiNode +public final class UnindexedJoinBiNode extends AbstractUnindexedJoinNode, B, BiTuple> { private final BiPredicate filtering; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractConcatNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractConcatNode.java similarity index 92% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractConcatNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractConcatNode.java index f6307c5b23..3f470f8759 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractConcatNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractConcatNode.java @@ -1,10 +1,10 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.LeftTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.RightTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleState; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.LeftTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.RightTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleState; /** * Implements the concat operation. Concat cannot be implemented as a pass-through operation because of two caveats: diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractFlattenLastNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractFlattenLastNode.java similarity index 95% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractFlattenLastNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractFlattenLastNode.java index a6e47a4833..f9b1e7310c 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractFlattenLastNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractFlattenLastNode.java @@ -1,4 +1,4 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; import java.util.ArrayList; import java.util.Collection; @@ -8,9 +8,9 @@ import java.util.Objects; import java.util.function.Function; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleState; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleState; public abstract class AbstractFlattenLastNode extends AbstractNode diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractGroupNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractGroupNode.java similarity index 97% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractGroupNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractGroupNode.java index 84084f97bb..70683f359e 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractGroupNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractGroupNode.java @@ -1,4 +1,4 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; import java.util.HashMap; import java.util.Map; @@ -7,9 +7,9 @@ import java.util.function.Supplier; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleState; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleState; public abstract class AbstractGroupNode extends AbstractNode diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractIfExistsNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractIfExistsNode.java similarity index 93% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractIfExistsNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractIfExistsNode.java index 775055c78f..37b4b73700 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractIfExistsNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractIfExistsNode.java @@ -1,11 +1,11 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; - -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.LeftTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.RightTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleState; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; +package ai.timefold.solver.core.impl.bavet.common; + +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.LeftTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.RightTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleState; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; import ai.timefold.solver.core.impl.util.ElementAwareList; import ai.timefold.solver.core.impl.util.ElementAwareListEntry; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractIndexedIfExistsNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractIndexedIfExistsNode.java similarity index 94% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractIndexedIfExistsNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractIndexedIfExistsNode.java index a6830ab0d8..a4f93e1ff9 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractIndexedIfExistsNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractIndexedIfExistsNode.java @@ -1,14 +1,14 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; import java.util.function.Function; -import ai.timefold.solver.core.impl.score.stream.bavet.common.index.IndexProperties; -import ai.timefold.solver.core.impl.score.stream.bavet.common.index.Indexer; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.LeftTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.RightTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; +import ai.timefold.solver.core.impl.bavet.common.index.IndexProperties; +import ai.timefold.solver.core.impl.bavet.common.index.Indexer; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.LeftTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.RightTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; import ai.timefold.solver.core.impl.util.ElementAwareList; import ai.timefold.solver.core.impl.util.ElementAwareListEntry; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractIndexedJoinNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractIndexedJoinNode.java similarity index 92% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractIndexedJoinNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractIndexedJoinNode.java index cfa1ccc8c1..0d21a6d0d8 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractIndexedJoinNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractIndexedJoinNode.java @@ -1,14 +1,14 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; import java.util.function.Function; -import ai.timefold.solver.core.impl.score.stream.bavet.common.index.IndexProperties; -import ai.timefold.solver.core.impl.score.stream.bavet.common.index.Indexer; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.LeftTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.RightTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; +import ai.timefold.solver.core.impl.bavet.common.index.IndexProperties; +import ai.timefold.solver.core.impl.bavet.common.index.Indexer; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.LeftTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.RightTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; import ai.timefold.solver.core.impl.util.ElementAwareList; import ai.timefold.solver.core.impl.util.ElementAwareListEntry; @@ -28,9 +28,6 @@ public abstract class AbstractIndexedJoinNode indexerLeft; private final Indexer> indexerRight; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractJoinNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractJoinNode.java similarity index 93% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractJoinNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractJoinNode.java index 2c9baabe9d..e4a73b837a 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractJoinNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractJoinNode.java @@ -1,13 +1,13 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; import java.util.function.Consumer; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.LeftTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.RightTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleState; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.LeftTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.RightTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleState; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; import ai.timefold.solver.core.impl.util.ElementAwareList; import ai.timefold.solver.core.impl.util.ElementAwareListEntry; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractMapNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractMapNode.java similarity index 89% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractMapNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractMapNode.java index eb45063319..16e0cbfde7 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractMapNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractMapNode.java @@ -1,8 +1,8 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleState; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleState; public abstract class AbstractMapNode extends AbstractNode diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractNode.java similarity index 96% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractNode.java index 3fb7a0b759..f218a22520 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractNode.java @@ -1,4 +1,4 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; import ai.timefold.solver.core.impl.score.stream.bavet.BavetConstraintSession; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/NodeBuildHelper.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractNodeBuildHelper.java similarity index 55% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/NodeBuildHelper.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractNodeBuildHelper.java index b4663acab6..141c0f5e27 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/NodeBuildHelper.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractNodeBuildHelper.java @@ -1,4 +1,4 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; import java.util.ArrayList; import java.util.Collections; @@ -8,30 +8,24 @@ import java.util.Set; import java.util.function.Function; -import ai.timefold.solver.core.api.score.Score; -import ai.timefold.solver.core.api.score.stream.ConstraintStream; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractConditionalTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.LeftTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.RightTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.uni.AbstractForEachUniNode; -import ai.timefold.solver.core.impl.score.stream.common.AbstractConstraintStream; -import ai.timefold.solver.core.impl.score.stream.common.inliner.AbstractScoreInliner; - -public final class NodeBuildHelper> { - - private final Set activeStreamSet; - private final AbstractScoreInliner scoreInliner; - private final Map> nodeCreatorMap; - private final Map> tupleLifecycleMap; - private final Map storeIndexMap; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractConditionalTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.LeftTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.RightTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.uni.AbstractForEachUniNode; + +public abstract class AbstractNodeBuildHelper { + + private final Set activeStreamSet; + private final Map nodeCreatorMap; + private final Map> tupleLifecycleMap; + private final Map storeIndexMap; private List reversedNodeList; - public NodeBuildHelper(Set activeStreamSet, AbstractScoreInliner scoreInliner) { + public AbstractNodeBuildHelper(Set activeStreamSet) { this.activeStreamSet = activeStreamSet; - this.scoreInliner = scoreInliner; int activeStreamSetSize = activeStreamSet.size(); this.nodeCreatorMap = new HashMap<>(Math.max(16, activeStreamSetSize)); this.tupleLifecycleMap = new HashMap<>(Math.max(16, activeStreamSetSize)); @@ -39,19 +33,15 @@ public NodeBuildHelper(Set activeStreamSet, Abstract this.reversedNodeList = new ArrayList<>(activeStreamSetSize); } - public boolean isStreamActive(ConstraintStream stream) { + public boolean isStreamActive(Stream_ stream) { return activeStreamSet.contains(stream); } - public AbstractScoreInliner getScoreInliner() { - return scoreInliner; - } - - public void addNode(AbstractNode node, BavetAbstractConstraintStream creator) { + public void addNode(AbstractNode node, Stream_ creator) { addNode(node, creator, creator); } - public void addNode(AbstractNode node, BavetAbstractConstraintStream creator, BavetAbstractConstraintStream parent) { + public void addNode(AbstractNode node, Stream_ creator, Stream_ parent) { reversedNodeList.add(node); nodeCreatorMap.put(node, creator); if (!(node instanceof AbstractForEachUniNode)) { @@ -62,54 +52,50 @@ public void addNode(AbstractNode node, BavetAbstractConstraintStream creator, } } - public void addNode(AbstractNode node, BavetAbstractConstraintStream creator, - BavetAbstractConstraintStream leftParent, - BavetAbstractConstraintStream rightParent) { + public void addNode(AbstractNode node, Stream_ creator, Stream_ leftParent, Stream_ rightParent) { reversedNodeList.add(node); nodeCreatorMap.put(node, creator); putInsertUpdateRetract(leftParent, TupleLifecycle.ofLeft((LeftTupleLifecycle) node)); putInsertUpdateRetract(rightParent, TupleLifecycle.ofRight((RightTupleLifecycle) node)); } - public void putInsertUpdateRetract(ConstraintStream stream, + public void putInsertUpdateRetract(Stream_ stream, TupleLifecycle tupleLifecycle) { tupleLifecycleMap.put(stream, tupleLifecycle); } - public void putInsertUpdateRetract(ConstraintStream stream, - List> childStreamList, + public void putInsertUpdateRetract(Stream_ stream, List childStreamList, Function, AbstractConditionalTupleLifecycle> tupleLifecycleFunction) { TupleLifecycle tupleLifecycle = getAggregatedTupleLifecycle(childStreamList); putInsertUpdateRetract(stream, tupleLifecycleFunction.apply(tupleLifecycle)); } + @SuppressWarnings("unchecked") public TupleLifecycle getAggregatedTupleLifecycle( - List streamList) { - TupleLifecycle[] tupleLifecycles = streamList.stream() + List streamList) { + var tupleLifecycles = streamList.stream() .filter(this::isStreamActive) .map(s -> getTupleLifecycle(s, tupleLifecycleMap)) .toArray(TupleLifecycle[]::new); - switch (tupleLifecycles.length) { - case 0: - throw new IllegalStateException("Impossible state: None of the streamList (" + streamList - + ") are active."); - case 1: - return tupleLifecycles[0]; - default: - return TupleLifecycle.of(tupleLifecycles); - } + return switch (tupleLifecycles.length) { + case 0 -> + throw new IllegalStateException("Impossible state: None of the streamList (" + streamList + ") are active."); + case 1 -> tupleLifecycles[0]; + default -> TupleLifecycle.of(tupleLifecycles); + }; } - private static TupleLifecycle getTupleLifecycle(ConstraintStream stream, - Map> tupleLifecycleMap) { - TupleLifecycle tupleLifecycle = (TupleLifecycle) tupleLifecycleMap.get(stream); + @SuppressWarnings("unchecked") + private static TupleLifecycle getTupleLifecycle(Stream_ stream, + Map> tupleLifecycleMap) { + var tupleLifecycle = (TupleLifecycle) tupleLifecycleMap.get(stream); if (tupleLifecycle == null) { throw new IllegalStateException("Impossible state: the stream (" + stream + ") hasn't built a node yet."); } return tupleLifecycle; } - public int reserveTupleStoreIndex(ConstraintStream tupleSourceStream) { + public int reserveTupleStoreIndex(Stream_ tupleSourceStream) { return storeIndexMap.compute(tupleSourceStream, (k, index) -> { if (index == null) { return 0; @@ -122,7 +108,7 @@ public int reserveTupleStoreIndex(ConstraintStream tupleSourceStream) { }); } - public int extractTupleStoreSize(ConstraintStream tupleSourceStream) { + public int extractTupleStoreSize(Stream_ tupleSourceStream) { Integer lastIndex = storeIndexMap.put(tupleSourceStream, Integer.MIN_VALUE); return (lastIndex == null) ? 0 : lastIndex + 1; } @@ -134,17 +120,17 @@ public List destroyAndGetNodeList() { return nodeList; } - public BavetAbstractConstraintStream getNodeCreatingStream(AbstractNode node) { + public Stream_ getNodeCreatingStream(AbstractNode node) { return nodeCreatorMap.get(node); } - public AbstractNode findParentNode(BavetAbstractConstraintStream childNodeCreator) { + public AbstractNode findParentNode(Stream_ childNodeCreator) { if (childNodeCreator == null) { // We've recursed to the bottom without finding a parent node. throw new IllegalStateException( "Impossible state: node-creating stream (" + childNodeCreator + ") has no parent node."); } // Look the stream up among node creators and if found, the node is the parent node. - for (Map.Entry> entry : this.nodeCreatorMap.entrySet()) { + for (Map.Entry entry : this.nodeCreatorMap.entrySet()) { if (entry.getValue() == childNodeCreator) { return entry.getKey(); } diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractPropagationMetadataCarrier.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractPropagationMetadataCarrier.java similarity index 69% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractPropagationMetadataCarrier.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractPropagationMetadataCarrier.java index ce7d115c9a..32b0116738 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractPropagationMetadataCarrier.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractPropagationMetadataCarrier.java @@ -1,7 +1,7 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleState; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleState; /** * {@link DynamicPropagationQueue} requires the items it carries to extend this class, diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractUnindexedIfExistsNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractUnindexedIfExistsNode.java similarity index 93% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractUnindexedIfExistsNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractUnindexedIfExistsNode.java index da48361acb..05c00744bd 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractUnindexedIfExistsNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractUnindexedIfExistsNode.java @@ -1,10 +1,10 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.LeftTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.RightTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.LeftTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.RightTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; import ai.timefold.solver.core.impl.util.ElementAwareList; import ai.timefold.solver.core.impl.util.ElementAwareListEntry; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractUnindexedJoinNode.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractUnindexedJoinNode.java similarity index 91% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractUnindexedJoinNode.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractUnindexedJoinNode.java index c2e447e066..29970a1e69 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/AbstractUnindexedJoinNode.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractUnindexedJoinNode.java @@ -1,10 +1,10 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.LeftTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.RightTupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.LeftTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.RightTupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.UniTuple; import ai.timefold.solver.core.impl.util.ElementAwareList; import ai.timefold.solver.core.impl.util.ElementAwareListEntry; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/BavetStream.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/BavetStream.java new file mode 100644 index 0000000000..5866eefdb8 --- /dev/null +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/BavetStream.java @@ -0,0 +1,7 @@ +package ai.timefold.solver.core.impl.bavet.common; + +public interface BavetStream { + + Stream_ getParent(); + +} diff --git a/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/BavetStreamBinaryOperation.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/BavetStreamBinaryOperation.java new file mode 100644 index 0000000000..592af1c7bc --- /dev/null +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/BavetStreamBinaryOperation.java @@ -0,0 +1,15 @@ +package ai.timefold.solver.core.impl.bavet.common; + +public interface BavetStreamBinaryOperation { + + /** + * @return An instance of fore bridge. + */ + Stream_ getLeftParent(); + + /** + * @return An instance of fore bridge. + */ + Stream_ getRightParent(); + +} diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/DynamicPropagationQueue.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/DynamicPropagationQueue.java similarity index 96% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/DynamicPropagationQueue.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/DynamicPropagationQueue.java index ed08103e81..2554b4e5cb 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/DynamicPropagationQueue.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/DynamicPropagationQueue.java @@ -1,13 +1,13 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; import java.util.ArrayList; import java.util.BitSet; import java.util.List; import java.util.function.Consumer; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleState; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleState; /** * This implementation has the capability to move tuples between the individual propagation queues. diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/ExistsCounter.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/ExistsCounter.java similarity index 75% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/ExistsCounter.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/ExistsCounter.java index 43ff7f0f6c..a47bdd2910 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/ExistsCounter.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/ExistsCounter.java @@ -1,7 +1,7 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleState; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleState; public final class ExistsCounter extends AbstractPropagationMetadataCarrier { diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/Group.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/Group.java similarity index 92% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/Group.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/Group.java index cbe02c73bd..dd2c33affa 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/Group.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/Group.java @@ -1,7 +1,7 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleState; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleState; final class Group extends AbstractPropagationMetadataCarrier { diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/GroupNodeConstructor.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/GroupNodeConstructor.java similarity index 90% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/GroupNodeConstructor.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/GroupNodeConstructor.java index 3722e6f613..bbe8b66f35 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/GroupNodeConstructor.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/GroupNodeConstructor.java @@ -1,17 +1,16 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; import java.util.List; -import ai.timefold.solver.core.api.score.Score; -import ai.timefold.solver.core.api.score.stream.ConstraintStream; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; import ai.timefold.solver.core.impl.util.Pair; import ai.timefold.solver.core.impl.util.Quadruple; import ai.timefold.solver.core.impl.util.Triple; -public interface GroupNodeConstructor { +public sealed interface GroupNodeConstructor + permits GroupNodeConstructorWithAccumulate, GroupNodeConstructorWithoutAccumulate { // Although Tuple_ is unused in GroupNodeConstructor, // it is used in its two implementations: GroupNodeConstructorWithAccumulate // and GroupNodeConstructorWithoutAccumulate. The Tuple_ here serves as a type hint @@ -57,7 +56,7 @@ public interface GroupNodeConstructor { zeroKeysGroupBy(CollectorA_ collectorA, CollectorB_ collectorB, CollectorC_ collectorC, GroupBy0Mapping3CollectorNodeBuilder builder) { return new GroupNodeConstructorWithAccumulate<>( - new Triple(collectorA, collectorB, collectorC), + new Triple<>(collectorA, collectorB, collectorC), (groupStoreIndex, undoStoreIndex, nextNodesTupleLifecycle, outputStoreSize, environmentMode) -> builder.build( groupStoreIndex, undoStoreIndex, collectorA, collectorB, collectorC, nextNodesTupleLifecycle, outputStoreSize, environmentMode)); @@ -67,7 +66,7 @@ public interface GroupNodeConstructor { zeroKeysGroupBy(CollectorA_ collectorA, CollectorB_ collectorB, CollectorC_ collectorC, CollectorD_ collectorD, GroupBy0Mapping4CollectorNodeBuilder builder) { return new GroupNodeConstructorWithAccumulate<>( - new Quadruple(collectorA, collectorB, collectorC, + new Quadruple<>(collectorA, collectorB, collectorC, collectorD), (groupStoreIndex, undoStoreIndex, nextNodesTupleLifecycle, outputStoreSize, environmentMode) -> builder.build( groupStoreIndex, undoStoreIndex, collectorA, collectorB, collectorC, collectorD, @@ -94,7 +93,7 @@ public interface GroupNodeConstructor { oneKeyGroupBy(KeyA_ keyMappingA, CollectorB_ collectorB, CollectorC_ collectorC, GroupBy1Mapping2CollectorNodeBuilder builder) { return new GroupNodeConstructorWithAccumulate<>( - new Triple(keyMappingA, collectorB, collectorC), + new Triple<>(keyMappingA, collectorB, collectorC), (groupStoreIndex, undoStoreIndex, nextNodesTupleLifecycle, outputStoreSize, environmentMode) -> builder.build( keyMappingA, groupStoreIndex, undoStoreIndex, collectorB, collectorC, nextNodesTupleLifecycle, @@ -105,7 +104,7 @@ public interface GroupNodeConstructor { oneKeyGroupBy(KeyA_ keyMappingA, CollectorB_ collectorB, CollectorC_ collectorC, CollectorD_ collectorD, GroupBy1Mapping3CollectorNodeBuilder builder) { return new GroupNodeConstructorWithAccumulate<>( - new Quadruple(keyMappingA, collectorB, collectorC, collectorD), + new Quadruple<>(keyMappingA, collectorB, collectorC, collectorD), (groupStoreIndex, undoStoreIndex, nextNodesTupleLifecycle, outputStoreSize, environmentMode) -> builder.build( keyMappingA, groupStoreIndex, undoStoreIndex, collectorB, collectorC, collectorD, nextNodesTupleLifecycle, @@ -125,7 +124,7 @@ public interface GroupNodeConstructor { twoKeysGroupBy(KeyA_ keyMappingA, KeyB_ keyMappingB, CollectorC_ collectorC, GroupBy2Mapping1CollectorNodeBuilder builder) { return new GroupNodeConstructorWithAccumulate<>( - new Triple(keyMappingA, keyMappingB, collectorC), + new Triple<>(keyMappingA, keyMappingB, collectorC), (groupStoreIndex, undoStoreIndex, nextNodesTupleLifecycle, outputStoreSize, environmentMode) -> builder.build( keyMappingA, keyMappingB, groupStoreIndex, undoStoreIndex, collectorC, nextNodesTupleLifecycle, @@ -136,7 +135,7 @@ public interface GroupNodeConstructor { twoKeysGroupBy(KeyA_ keyMappingA, KeyB_ keyMappingB, CollectorC_ collectorC, CollectorD_ collectorD, GroupBy2Mapping2CollectorNodeBuilder builder) { return new GroupNodeConstructorWithAccumulate<>( - new Quadruple(keyMappingA, keyMappingB, collectorC, collectorD), + new Quadruple<>(keyMappingA, keyMappingB, collectorC, collectorD), (groupStoreIndex, undoStoreIndex, nextNodesTupleLifecycle, outputStoreSize, environmentMode) -> builder.build( keyMappingA, keyMappingB, groupStoreIndex, undoStoreIndex, collectorC, collectorD, nextNodesTupleLifecycle, @@ -147,7 +146,7 @@ public interface GroupNodeConstructor { threeKeysGroupBy(KeyA_ keyMappingA, KeyB_ keyMappingB, KeyC_ keyMappingC, GroupBy3Mapping0CollectorNodeBuilder builder) { return new GroupNodeConstructorWithoutAccumulate<>( - new Triple(keyMappingA, keyMappingB, keyMappingC), + new Triple<>(keyMappingA, keyMappingB, keyMappingC), (groupStoreIndex, nextNodesTupleLifecycle, outputStoreSize, environmentMode) -> builder.build(keyMappingA, keyMappingB, keyMappingC, groupStoreIndex, nextNodesTupleLifecycle, outputStoreSize, environmentMode)); @@ -157,7 +156,7 @@ public interface GroupNodeConstructor { threeKeysGroupBy(KeyA_ keyMappingA, KeyB_ keyMappingB, KeyC_ keyMappingC, CollectorD_ collectorD, GroupBy3Mapping1CollectorNodeBuilder builder) { return new GroupNodeConstructorWithAccumulate<>( - new Quadruple(keyMappingA, keyMappingB, keyMappingC, collectorD), + new Quadruple<>(keyMappingA, keyMappingB, keyMappingC, collectorD), (groupStoreIndex, undoStoreIndex, nextNodesTupleLifecycle, outputStoreSize, environmentMode) -> builder.build( keyMappingA, keyMappingB, keyMappingC, groupStoreIndex, undoStoreIndex, collectorD, nextNodesTupleLifecycle, @@ -168,7 +167,7 @@ public interface GroupNodeConstructor { fourKeysGroupBy(KeyA_ keyMappingA, KeyB_ keyMappingB, KeyC_ keyMappingC, KeyD_ keyMappingD, GroupBy4Mapping0CollectorNodeBuilder builder) { return new GroupNodeConstructorWithoutAccumulate<>( - new Quadruple(keyMappingA, keyMappingB, keyMappingC, keyMappingD), + new Quadruple<>(keyMappingA, keyMappingB, keyMappingC, keyMappingD), (groupStoreIndex, nextNodesTupleLifecycle, outputStoreSize, environmentMode) -> builder.build(keyMappingA, keyMappingB, keyMappingC, keyMappingD, groupStoreIndex, nextNodesTupleLifecycle, outputStoreSize, environmentMode)); @@ -312,10 +311,8 @@ AbstractNode build(KeyA_ keyMappingA, TupleLifecycle nextNodesTupleLifecycle, int outputStoreSize, EnvironmentMode environmentMode); } - > void build(NodeBuildHelper buildHelper, - BavetAbstractConstraintStream parentTupleSource, - BavetAbstractConstraintStream aftStream, List aftStreamChildList, - BavetAbstractConstraintStream thisStream, - List thisStreamChildList, EnvironmentMode environmentMode); + void build(AbstractNodeBuildHelper buildHelper, Stream_ parentTupleSource, + Stream_ aftStream, List aftStreamChildList, Stream_ thisStream, List thisStreamChildList, + EnvironmentMode environmentMode); } diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/GroupNodeConstructorWithAccumulate.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/GroupNodeConstructorWithAccumulate.java similarity index 61% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/GroupNodeConstructorWithAccumulate.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/GroupNodeConstructorWithAccumulate.java index 79529d91d9..8ea0e87de2 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/GroupNodeConstructorWithAccumulate.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/GroupNodeConstructorWithAccumulate.java @@ -1,13 +1,11 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; import java.util.List; import java.util.Objects; -import ai.timefold.solver.core.api.score.Score; -import ai.timefold.solver.core.api.score.stream.ConstraintStream; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; final class GroupNodeConstructorWithAccumulate implements GroupNodeConstructor { @@ -21,19 +19,17 @@ public GroupNodeConstructorWithAccumulate(Object equalityKey, } @Override - public > void build(NodeBuildHelper buildHelper, - BavetAbstractConstraintStream parentTupleSource, - BavetAbstractConstraintStream aftStream, List aftStreamChildList, - BavetAbstractConstraintStream bridgeStream, List bridgeStreamChildList, + public void build(AbstractNodeBuildHelper buildHelper, Stream_ parentTupleSource, + Stream_ aftStream, List aftStreamChildList, Stream_ bridgeStream, List bridgeStreamChildList, EnvironmentMode environmentMode) { if (!bridgeStreamChildList.isEmpty()) { throw new IllegalStateException("Impossible state: the stream (" + bridgeStream + ") has an non-empty childStreamList (" + bridgeStreamChildList + ") but it's a groupBy bridge."); } - int groupStoreIndex = buildHelper.reserveTupleStoreIndex(parentTupleSource); - int undoStoreIndex = buildHelper.reserveTupleStoreIndex(parentTupleSource); + var groupStoreIndex = buildHelper.reserveTupleStoreIndex(parentTupleSource); + var undoStoreIndex = buildHelper.reserveTupleStoreIndex(parentTupleSource); TupleLifecycle tupleLifecycle = buildHelper.getAggregatedTupleLifecycle(aftStreamChildList); - int outputStoreSize = buildHelper.extractTupleStoreSize(aftStream); + var outputStoreSize = buildHelper.extractTupleStoreSize(aftStream); var node = nodeConstructorFunction.apply(groupStoreIndex, undoStoreIndex, tupleLifecycle, outputStoreSize, environmentMode); buildHelper.addNode(node, bridgeStream); @@ -45,7 +41,7 @@ public boolean equals(Object object) { return true; if (object == null || getClass() != object.getClass()) return false; - GroupNodeConstructorWithAccumulate that = (GroupNodeConstructorWithAccumulate) object; + var that = (GroupNodeConstructorWithAccumulate) object; return Objects.equals(equalityKey, that.equalityKey); } diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/GroupNodeConstructorWithoutAccumulate.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/GroupNodeConstructorWithoutAccumulate.java similarity index 62% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/GroupNodeConstructorWithoutAccumulate.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/GroupNodeConstructorWithoutAccumulate.java index b2f5783f72..4a462d0715 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/GroupNodeConstructorWithoutAccumulate.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/GroupNodeConstructorWithoutAccumulate.java @@ -1,13 +1,11 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; import java.util.List; import java.util.Objects; -import ai.timefold.solver.core.api.score.Score; -import ai.timefold.solver.core.api.score.stream.ConstraintStream; import ai.timefold.solver.core.config.solver.EnvironmentMode; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; final class GroupNodeConstructorWithoutAccumulate implements GroupNodeConstructor { @@ -21,18 +19,16 @@ public GroupNodeConstructorWithoutAccumulate(Object equalityKey, } @Override - public > void build(NodeBuildHelper buildHelper, - BavetAbstractConstraintStream parentTupleSource, - BavetAbstractConstraintStream aftStream, List aftStreamChildList, - BavetAbstractConstraintStream bridgeStream, List bridgeStreamChildList, + public void build(AbstractNodeBuildHelper buildHelper, Stream_ parentTupleSource, + Stream_ aftStream, List aftStreamChildList, Stream_ bridgeStream, List bridgeStreamChildList, EnvironmentMode environmentMode) { if (!bridgeStreamChildList.isEmpty()) { throw new IllegalStateException("Impossible state: the stream (" + bridgeStream + ") has an non-empty childStreamList (" + bridgeStreamChildList + ") but it's a groupBy bridge."); } - int groupStoreIndex = buildHelper.reserveTupleStoreIndex(parentTupleSource); + var groupStoreIndex = buildHelper.reserveTupleStoreIndex(parentTupleSource); TupleLifecycle tupleLifecycle = buildHelper.getAggregatedTupleLifecycle(aftStreamChildList); - int outputStoreSize = buildHelper.extractTupleStoreSize(aftStream); + var outputStoreSize = buildHelper.extractTupleStoreSize(aftStream); var node = nodeConstructorFunction.apply(groupStoreIndex, tupleLifecycle, outputStoreSize, environmentMode); buildHelper.addNode(node, bridgeStream); } @@ -43,7 +39,7 @@ public boolean equals(Object object) { return true; if (object == null || getClass() != object.getClass()) return false; - GroupNodeConstructorWithoutAccumulate that = (GroupNodeConstructorWithoutAccumulate) object; + var that = (GroupNodeConstructorWithoutAccumulate) object; return Objects.equals(equalityKey, that.equalityKey); } diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/PropagationQueue.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/PropagationQueue.java similarity index 91% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/PropagationQueue.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/PropagationQueue.java index 4d0d38d998..695661e0ac 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/PropagationQueue.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/PropagationQueue.java @@ -1,6 +1,6 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleState; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleState; /** * A propagation queue is an ordered collection of items that need to be sent to the next node. diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/Propagator.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/Propagator.java similarity index 98% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/Propagator.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/Propagator.java index b18d1d92b4..ba0dfd9fe7 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/Propagator.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/Propagator.java @@ -1,4 +1,4 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; import ai.timefold.solver.core.impl.score.stream.bavet.BavetConstraintSession; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/StaticPropagationQueue.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/StaticPropagationQueue.java similarity index 93% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/StaticPropagationQueue.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/StaticPropagationQueue.java index 05012d74ef..f43ed6a96c 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/StaticPropagationQueue.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/StaticPropagationQueue.java @@ -1,12 +1,12 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common; +package ai.timefold.solver.core.impl.bavet.common; import java.util.ArrayDeque; import java.util.Deque; import java.util.function.Consumer; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleState; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleLifecycle; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleState; /** * The implementation moves tuples directly into an either retract, update or insert queue, diff --git a/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/TupleSource.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/TupleSource.java new file mode 100644 index 0000000000..b2324c5f26 --- /dev/null +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/TupleSource.java @@ -0,0 +1,4 @@ +package ai.timefold.solver.core.impl.bavet.common; + +public interface TupleSource { +} diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/ComparisonIndexer.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/ComparisonIndexer.java similarity index 98% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/ComparisonIndexer.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/ComparisonIndexer.java index f5db0db071..1706a39b9d 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/ComparisonIndexer.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/ComparisonIndexer.java @@ -1,4 +1,4 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common.index; +package ai.timefold.solver.core.impl.bavet.common.index; import java.util.Comparator; import java.util.Map; @@ -8,7 +8,7 @@ import java.util.function.Consumer; import java.util.function.Supplier; -import ai.timefold.solver.core.impl.score.stream.JoinerType; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.JoinerType; import ai.timefold.solver.core.impl.util.ElementAwareListEntry; final class ComparisonIndexer> diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/EqualsIndexer.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/EqualsIndexer.java similarity index 97% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/EqualsIndexer.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/EqualsIndexer.java index d9e9bc20d1..df1b2d9332 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/EqualsIndexer.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/EqualsIndexer.java @@ -1,4 +1,4 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common.index; +package ai.timefold.solver.core.impl.bavet.common.index; import java.util.HashMap; import java.util.Map; diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/IndexProperties.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/IndexProperties.java similarity index 92% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/IndexProperties.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/IndexProperties.java index 2da212869c..fab4c43fc1 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/IndexProperties.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/IndexProperties.java @@ -1,4 +1,4 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common.index; +package ai.timefold.solver.core.impl.bavet.common.index; /** * Cached in tuples; each tuple carries its unique instance. diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/Indexer.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/Indexer.java similarity index 90% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/Indexer.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/Indexer.java index 1c90af0781..97932d6a82 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/Indexer.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/Indexer.java @@ -1,8 +1,8 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common.index; +package ai.timefold.solver.core.impl.bavet.common.index; import java.util.function.Consumer; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleState; +import ai.timefold.solver.core.impl.bavet.common.tuple.TupleState; import ai.timefold.solver.core.impl.util.ElementAwareListEntry; /** diff --git a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/IndexerFactory.java b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/IndexerFactory.java similarity index 74% rename from core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/IndexerFactory.java rename to core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/IndexerFactory.java index 31b18a762f..67a5b5cfcd 100644 --- a/core/src/main/java/ai/timefold/solver/core/impl/score/stream/bavet/common/index/IndexerFactory.java +++ b/core/src/main/java/ai/timefold/solver/core/impl/bavet/common/index/IndexerFactory.java @@ -1,4 +1,4 @@ -package ai.timefold.solver.core.impl.score.stream.bavet.common.index; +package ai.timefold.solver.core.impl.bavet.common.index; import java.util.ArrayList; import java.util.NavigableMap; @@ -9,14 +9,14 @@ import ai.timefold.solver.core.api.function.QuadFunction; import ai.timefold.solver.core.api.function.TriFunction; -import ai.timefold.solver.core.impl.score.stream.JoinerType; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.AbstractTuple; -import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TriTuple; -import ai.timefold.solver.core.impl.score.stream.common.AbstractJoiner; -import ai.timefold.solver.core.impl.score.stream.common.bi.DefaultBiJoiner; -import ai.timefold.solver.core.impl.score.stream.common.penta.DefaultPentaJoiner; -import ai.timefold.solver.core.impl.score.stream.common.quad.DefaultQuadJoiner; -import ai.timefold.solver.core.impl.score.stream.common.tri.DefaultTriJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.AbstractJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.DefaultBiJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.DefaultPentaJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.DefaultQuadJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.DefaultTriJoiner; +import ai.timefold.solver.core.impl.bavet.common.index.joiner.JoinerType; +import ai.timefold.solver.core.impl.bavet.common.tuple.AbstractTuple; +import ai.timefold.solver.core.impl.bavet.common.tuple.TriTuple; import ai.timefold.solver.core.impl.util.Pair; import ai.timefold.solver.core.impl.util.Quadruple; import ai.timefold.solver.core.impl.util.Triple; @@ -24,32 +24,27 @@ /** * {@link Indexer Indexers} form a parent-child hierarchy, * each child has exactly one parent. - * {@link ai.timefold.solver.core.impl.score.stream.bavet.common.index.NoneIndexer} is always at the bottom of the hierarchy, + * {@link NoneIndexer} is always at the bottom of the hierarchy, * never a parent unless it is the only indexer. * Parent indexers delegate to their children, - * until they reach the ultimate {@link ai.timefold.solver.core.impl.score.stream.bavet.common.index.NoneIndexer}. + * until they reach the ultimate {@link NoneIndexer}. *

* Example 1: EQUAL+LESS_THAN joiner will become EqualsIndexer -> ComparisonIndexer -> NoneIndexer. *

* Indexers have an id, which is the position of the indexer in the chain. * Top-most indexer has id 0, and the id increases as we go down the hierarchy. - * Each {@link AbstractTuple tuple} is assigned an - * {@link ai.timefold.solver.core.impl.score.stream.bavet.common.index.IndexProperties} instance, + * Each {@link AbstractTuple tuple} is assigned an {@link IndexProperties} instance, * which determines its location in the index. - * {@link ai.timefold.solver.core.impl.score.stream.bavet.common.index.IndexProperties} instances are built from - * {@link AbstractJoiner joiners} + * {@link IndexProperties} instances are built from {@link AbstractJoiner joiners} * using methods such as {@link #buildUniLeftMapping()} and {@link #buildRightMapping()}. - * Each {@link ai.timefold.solver.core.impl.score.stream.bavet.common.index.IndexProperties#toKey(int) index keyFunction} has an - * id, + * Each {@link IndexProperties#toKey(int) index keyFunction} has an id, * and this id matches the id of the indexer; - * each keyFunction in {@link ai.timefold.solver.core.impl.score.stream.bavet.common.index.IndexProperties} is associated with a - * single indexer. + * each keyFunction in {@link IndexProperties} is associated with a single indexer. *

* Comparison joiners result in a single indexer each, * whereas equal joiners will be merged into a single indexer if they are consecutive. * In the latter case, - * a composite keyFunction is created of type {@link Pair}, {@link TriTuple}, - * {@link Quadruple} or {@link ai.timefold.solver.core.impl.score.stream.bavet.common.index.IndexerKey}, + * a composite keyFunction is created of type {@link Pair}, {@link TriTuple}, {@link Quadruple} or {@link IndexerKey}, * based on the length of the composite keyFunction (number of equals joiners in sequence). * *