|
1 | 1 | package ai.timefold.solver.core.impl.score.stream.bavet.bi; |
2 | 2 |
|
3 | | -import java.util.function.BiFunction; |
4 | | -import java.util.function.Function; |
5 | | - |
6 | 3 | import ai.timefold.solver.core.api.function.TriPredicate; |
7 | 4 | import ai.timefold.solver.core.impl.score.stream.bavet.common.AbstractIndexedIfExistsNode; |
8 | | -import ai.timefold.solver.core.impl.score.stream.bavet.common.ExistsCounter; |
9 | | -import ai.timefold.solver.core.impl.score.stream.bavet.common.index.IndexProperties; |
10 | | -import ai.timefold.solver.core.impl.score.stream.bavet.common.index.Indexer; |
| 5 | +import ai.timefold.solver.core.impl.score.stream.bavet.common.index.IndexerFactory; |
11 | 6 | import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.BiTuple; |
12 | 7 | import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.TupleLifecycle; |
13 | 8 | import ai.timefold.solver.core.impl.score.stream.bavet.common.tuple.UniTuple; |
14 | 9 |
|
15 | 10 | final class IndexedIfExistsBiNode<A, B, C> extends AbstractIndexedIfExistsNode<BiTuple<A, B>, C> { |
16 | 11 |
|
17 | | - private final BiFunction<A, B, IndexProperties> mappingAB; |
18 | 12 | private final TriPredicate<A, B, C> filtering; |
19 | 13 |
|
20 | | - public IndexedIfExistsBiNode(boolean shouldExist, |
21 | | - BiFunction<A, B, IndexProperties> mappingAB, Function<C, IndexProperties> mappingC, |
22 | | - int inputStoreIndexLeftProperties, int inputStoreIndexLeftCounterEntry, int inputStoreIndexRightProperties, |
23 | | - int inputStoreIndexRightEntry, |
24 | | - TupleLifecycle<BiTuple<A, B>> nextNodesTupleLifecycle, |
25 | | - Indexer<ExistsCounter<BiTuple<A, B>>> indexerAB, Indexer<UniTuple<C>> indexerC) { |
26 | | - this(shouldExist, mappingAB, mappingC, |
27 | | - inputStoreIndexLeftProperties, inputStoreIndexLeftCounterEntry, -1, inputStoreIndexRightProperties, |
28 | | - inputStoreIndexRightEntry, -1, |
29 | | - nextNodesTupleLifecycle, indexerAB, indexerC, |
30 | | - null); |
| 14 | + public IndexedIfExistsBiNode(boolean shouldExist, IndexerFactory<C> indexerFactory, |
| 15 | + int inputStoreIndexLeftKeys, int inputStoreIndexLeftCounterEntry, |
| 16 | + int inputStoreIndexRightKeys, int inputStoreIndexRightEntry, |
| 17 | + TupleLifecycle<BiTuple<A, B>> nextNodesTupleLifecycle) { |
| 18 | + this(shouldExist, indexerFactory, |
| 19 | + inputStoreIndexLeftKeys, inputStoreIndexLeftCounterEntry, -1, |
| 20 | + inputStoreIndexRightKeys, inputStoreIndexRightEntry, -1, |
| 21 | + nextNodesTupleLifecycle, null); |
31 | 22 | } |
32 | 23 |
|
33 | | - public IndexedIfExistsBiNode(boolean shouldExist, |
34 | | - BiFunction<A, B, IndexProperties> mappingAB, Function<C, IndexProperties> mappingC, |
35 | | - int inputStoreIndexLeftProperties, int inputStoreIndexLeftCounterEntry, int inputStoreIndexLeftTrackerList, |
36 | | - int inputStoreIndexRightProperties, int inputStoreIndexRightEntry, int inputStoreIndexRightTrackerList, |
37 | | - TupleLifecycle<BiTuple<A, B>> nextNodesTupleLifecycle, |
38 | | - Indexer<ExistsCounter<BiTuple<A, B>>> indexerAB, Indexer<UniTuple<C>> indexerC, |
39 | | - TriPredicate<A, B, C> filtering) { |
40 | | - super(shouldExist, mappingC, |
41 | | - inputStoreIndexLeftProperties, inputStoreIndexLeftCounterEntry, inputStoreIndexLeftTrackerList, |
42 | | - inputStoreIndexRightProperties, inputStoreIndexRightEntry, inputStoreIndexRightTrackerList, |
43 | | - nextNodesTupleLifecycle, indexerAB, indexerC, |
44 | | - filtering != null); |
45 | | - this.mappingAB = mappingAB; |
| 24 | + public IndexedIfExistsBiNode(boolean shouldExist, IndexerFactory<C> indexerFactory, |
| 25 | + int inputStoreIndexLeftKeys, int inputStoreIndexLeftCounterEntry, int inputStoreIndexLeftTrackerList, |
| 26 | + int inputStoreIndexRightKeys, int inputStoreIndexRightEntry, int inputStoreIndexRightTrackerList, |
| 27 | + TupleLifecycle<BiTuple<A, B>> nextNodesTupleLifecycle, TriPredicate<A, B, C> filtering) { |
| 28 | + super(shouldExist, indexerFactory.buildBiLeftKeysExtractor(), indexerFactory, |
| 29 | + inputStoreIndexLeftKeys, inputStoreIndexLeftCounterEntry, inputStoreIndexLeftTrackerList, |
| 30 | + inputStoreIndexRightKeys, inputStoreIndexRightEntry, inputStoreIndexRightTrackerList, |
| 31 | + nextNodesTupleLifecycle, filtering != null); |
46 | 32 | this.filtering = filtering; |
47 | 33 | } |
48 | 34 |
|
49 | | - @Override |
50 | | - protected IndexProperties createIndexProperties(BiTuple<A, B> leftTuple) { |
51 | | - return mappingAB.apply(leftTuple.factA, leftTuple.factB); |
52 | | - } |
53 | | - |
54 | 35 | @Override |
55 | 36 | protected boolean testFiltering(BiTuple<A, B> leftTuple, UniTuple<C> rightTuple) { |
56 | 37 | return filtering.test(leftTuple.factA, leftTuple.factB, rightTuple.factA); |
|
0 commit comments