summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2024-06-27 19:47:46 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2024-06-28 00:22:40 +0200
commit0bd7854ae802ad04c1c9e3da4e87dde542152b46 (patch)
treebf619e7cc716c058f094ce1267059d7c828ada94
parentinterpreter: Fix NPE in VQE wipe/dispose -> EVM -> MatchUpdateListener chains (diff)
downloadrefinery-0bd7854ae802ad04c1c9e3da4e87dde542152b46.tar.gz
refinery-0bd7854ae802ad04c1c9e3da4e87dde542152b46.tar.zst
refinery-0bd7854ae802ad04c1c9e3da4e87dde542152b46.zip
refactor(store): NeighborhoodCalculator API
* Use US English spelling consistently * Avoid Eclipse Collections types on API
-rw-r--r--subprojects/generator/src/main/java/tools/refinery/generator/ModelGeneratorFactory.java10
-rw-r--r--subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/interpretation/PartialNeighborhoodCalculator.java (renamed from subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/interpretation/PartialNeighbourhoodCalculator.java)11
-rw-r--r--subprojects/store/build.gradle.kts2
-rw-r--r--subprojects/store/src/main/java/tools/refinery/store/statecoding/StateCodeCalculatorFactory.java5
-rw-r--r--subprojects/store/src/main/java/tools/refinery/store/statecoding/StateEquivalenceChecker.java4
-rw-r--r--subprojects/store/src/main/java/tools/refinery/store/statecoding/internal/StateCoderBuilderImpl.java4
-rw-r--r--subprojects/store/src/main/java/tools/refinery/store/statecoding/internal/StateCoderStoreAdapterImpl.java6
-rw-r--r--subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/AbstractNeighborhoodCalculator.java (renamed from subprojects/store/src/main/java/tools/refinery/store/statecoding/neighbourhood/AbstractNeighbourhoodCalculator.java)14
-rw-r--r--subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/IndividualsArray.java27
-rw-r--r--subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/IndividualsSet.java26
-rw-r--r--subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/NeighborhoodCalculator.java (renamed from subprojects/store/src/main/java/tools/refinery/store/statecoding/neighbourhood/NeighbourhoodCalculator.java)11
-rw-r--r--subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/ObjectCodeImpl.java (renamed from subprojects/store/src/main/java/tools/refinery/store/statecoding/neighbourhood/ObjectCodeImpl.java)2
-rw-r--r--subprojects/store/src/main/java/tools/refinery/store/statecoding/stateequivalence/StateEquivalenceCheckerImpl.java15
-rw-r--r--subprojects/store/src/test/java/tools/refinery/store/statecoding/EquivalenceTest.java2
14 files changed, 96 insertions, 43 deletions
diff --git a/subprojects/generator/src/main/java/tools/refinery/generator/ModelGeneratorFactory.java b/subprojects/generator/src/main/java/tools/refinery/generator/ModelGeneratorFactory.java
index 877db0bb..ca9dd728 100644
--- a/subprojects/generator/src/main/java/tools/refinery/generator/ModelGeneratorFactory.java
+++ b/subprojects/generator/src/main/java/tools/refinery/generator/ModelGeneratorFactory.java
@@ -15,11 +15,11 @@ import tools.refinery.store.dse.transition.DesignSpaceExplorationAdapter;
15import tools.refinery.store.model.ModelStore; 15import tools.refinery.store.model.ModelStore;
16import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; 16import tools.refinery.store.query.interpreter.QueryInterpreterAdapter;
17import tools.refinery.store.reasoning.ReasoningAdapter; 17import tools.refinery.store.reasoning.ReasoningAdapter;
18import tools.refinery.store.reasoning.interpretation.PartialNeighbourhoodCalculator; 18import tools.refinery.store.reasoning.interpretation.PartialNeighborhoodCalculator;
19import tools.refinery.store.reasoning.literal.Concreteness; 19import tools.refinery.store.reasoning.literal.Concreteness;
20import tools.refinery.store.statecoding.StateCodeCalculatorFactory; 20import tools.refinery.store.statecoding.StateCodeCalculatorFactory;
21import tools.refinery.store.statecoding.StateCoderAdapter; 21import tools.refinery.store.statecoding.StateCoderAdapter;
22import tools.refinery.store.statecoding.neighbourhood.NeighbourhoodCalculator; 22import tools.refinery.store.statecoding.neighborhood.NeighborhoodCalculator;
23import tools.refinery.store.util.CancellationToken; 23import tools.refinery.store.util.CancellationToken;
24 24
25import java.util.Collection; 25import java.util.Collection;
@@ -40,7 +40,7 @@ public final class ModelGeneratorFactory {
40 40
41 private boolean partialInterpretationBasedNeighbourhoods; 41 private boolean partialInterpretationBasedNeighbourhoods;
42 42
43 private int stateCoderDepth = NeighbourhoodCalculator.DEFAULT_DEPTH; 43 private int stateCoderDepth = NeighborhoodCalculator.DEFAULT_DEPTH;
44 44
45 public ModelGeneratorFactory cancellationToken(CancellationToken cancellationToken) { 45 public ModelGeneratorFactory cancellationToken(CancellationToken cancellationToken) {
46 this.cancellationToken = cancellationToken; 46 this.cancellationToken = cancellationToken;
@@ -90,7 +90,7 @@ public final class ModelGeneratorFactory {
90 90
91 private StateCodeCalculatorFactory getStateCoderCalculatorFactory() { 91 private StateCodeCalculatorFactory getStateCoderCalculatorFactory() {
92 return partialInterpretationBasedNeighbourhoods ? 92 return partialInterpretationBasedNeighbourhoods ?
93 PartialNeighbourhoodCalculator.factory(Concreteness.PARTIAL, stateCoderDepth) : 93 PartialNeighborhoodCalculator.factory(Concreteness.PARTIAL, stateCoderDepth) :
94 NeighbourhoodCalculator.factory(stateCoderDepth); 94 NeighborhoodCalculator.factory(stateCoderDepth);
95 } 95 }
96} 96}
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/interpretation/PartialNeighbourhoodCalculator.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/interpretation/PartialNeighborhoodCalculator.java
index 67e20dbc..31295e64 100644
--- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/interpretation/PartialNeighbourhoodCalculator.java
+++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/interpretation/PartialNeighborhoodCalculator.java
@@ -5,7 +5,6 @@
5 */ 5 */
6package tools.refinery.store.reasoning.interpretation; 6package tools.refinery.store.reasoning.interpretation;
7 7
8import org.eclipse.collections.api.set.primitive.IntSet;
9import tools.refinery.store.map.Cursor; 8import tools.refinery.store.map.Cursor;
10import tools.refinery.store.model.Model; 9import tools.refinery.store.model.Model;
11import tools.refinery.store.query.ModelQueryAdapter; 10import tools.refinery.store.query.ModelQueryAdapter;
@@ -14,16 +13,18 @@ import tools.refinery.store.reasoning.literal.Concreteness;
14import tools.refinery.store.reasoning.representation.PartialSymbol; 13import tools.refinery.store.reasoning.representation.PartialSymbol;
15import tools.refinery.store.statecoding.StateCodeCalculatorFactory; 14import tools.refinery.store.statecoding.StateCodeCalculatorFactory;
16import tools.refinery.store.statecoding.StateCoderResult; 15import tools.refinery.store.statecoding.StateCoderResult;
17import tools.refinery.store.statecoding.neighbourhood.AbstractNeighbourhoodCalculator; 16import tools.refinery.store.statecoding.neighborhood.AbstractNeighborhoodCalculator;
17import tools.refinery.store.statecoding.neighborhood.IndividualsSet;
18import tools.refinery.store.tuple.Tuple; 18import tools.refinery.store.tuple.Tuple;
19 19
20import java.util.List; 20import java.util.List;
21 21
22public class PartialNeighbourhoodCalculator extends AbstractNeighbourhoodCalculator<PartialInterpretation<?, ?>> { 22public class PartialNeighborhoodCalculator extends AbstractNeighborhoodCalculator<PartialInterpretation<?, ?>> {
23 private final ModelQueryAdapter queryAdapter; 23 private final ModelQueryAdapter queryAdapter;
24 private final Concreteness concreteness; 24 private final Concreteness concreteness;
25 25
26 protected PartialNeighbourhoodCalculator(Model model, IntSet individuals, Concreteness concreteness, int depth) { 26 protected PartialNeighborhoodCalculator(Model model, IndividualsSet individuals, Concreteness concreteness,
27 int depth) {
27 super(model, individuals, depth); 28 super(model, individuals, depth);
28 queryAdapter = model.getAdapter(ModelQueryAdapter.class); 29 queryAdapter = model.getAdapter(ModelQueryAdapter.class);
29 this.concreteness = concreteness; 30 this.concreteness = concreteness;
@@ -61,7 +62,7 @@ public class PartialNeighbourhoodCalculator extends AbstractNeighbourhoodCalcula
61 } 62 }
62 63
63 public static StateCodeCalculatorFactory factory(Concreteness concreteness, int depth) { 64 public static StateCodeCalculatorFactory factory(Concreteness concreteness, int depth) {
64 return (model, interpretations, individuals) -> new PartialNeighbourhoodCalculator(model, individuals, 65 return (model, interpretations, individuals) -> new PartialNeighborhoodCalculator(model, individuals,
65 concreteness, depth); 66 concreteness, depth);
66 } 67 }
67} 68}
diff --git a/subprojects/store/build.gradle.kts b/subprojects/store/build.gradle.kts
index 55938987..ac4b92f6 100644
--- a/subprojects/store/build.gradle.kts
+++ b/subprojects/store/build.gradle.kts
@@ -14,6 +14,6 @@ mavenArtifact {
14} 14}
15 15
16dependencies { 16dependencies {
17 api(libs.eclipseCollections.api) 17 implementation(libs.eclipseCollections.api)
18 runtimeOnly(libs.eclipseCollections) 18 runtimeOnly(libs.eclipseCollections)
19} 19}
diff --git a/subprojects/store/src/main/java/tools/refinery/store/statecoding/StateCodeCalculatorFactory.java b/subprojects/store/src/main/java/tools/refinery/store/statecoding/StateCodeCalculatorFactory.java
index 809205e4..5e2a94b3 100644
--- a/subprojects/store/src/main/java/tools/refinery/store/statecoding/StateCodeCalculatorFactory.java
+++ b/subprojects/store/src/main/java/tools/refinery/store/statecoding/StateCodeCalculatorFactory.java
@@ -5,12 +5,13 @@
5 */ 5 */
6package tools.refinery.store.statecoding; 6package tools.refinery.store.statecoding;
7 7
8import org.eclipse.collections.api.set.primitive.IntSet;
9import tools.refinery.store.model.Interpretation; 8import tools.refinery.store.model.Interpretation;
10import tools.refinery.store.model.Model; 9import tools.refinery.store.model.Model;
10import tools.refinery.store.statecoding.neighborhood.IndividualsSet;
11 11
12import java.util.List; 12import java.util.List;
13 13
14public interface StateCodeCalculatorFactory { 14public interface StateCodeCalculatorFactory {
15 StateCodeCalculator create(Model model, List<? extends Interpretation<?>> interpretations, IntSet individuals); 15 StateCodeCalculator create(Model model, List<? extends Interpretation<?>> interpretations,
16 IndividualsSet individuals);
16} 17}
diff --git a/subprojects/store/src/main/java/tools/refinery/store/statecoding/StateEquivalenceChecker.java b/subprojects/store/src/main/java/tools/refinery/store/statecoding/StateEquivalenceChecker.java
index 0f0023ed..ae599dff 100644
--- a/subprojects/store/src/main/java/tools/refinery/store/statecoding/StateEquivalenceChecker.java
+++ b/subprojects/store/src/main/java/tools/refinery/store/statecoding/StateEquivalenceChecker.java
@@ -5,8 +5,8 @@
5 */ 5 */
6package tools.refinery.store.statecoding; 6package tools.refinery.store.statecoding;
7 7
8import org.eclipse.collections.api.set.primitive.IntSet;
9import tools.refinery.store.model.AnyInterpretation; 8import tools.refinery.store.model.AnyInterpretation;
9import tools.refinery.store.statecoding.neighborhood.IndividualsSet;
10 10
11import java.util.List; 11import java.util.List;
12 12
@@ -16,6 +16,6 @@ public interface StateEquivalenceChecker {
16 } 16 }
17 17
18 EquivalenceResult constructMorphism( 18 EquivalenceResult constructMorphism(
19 IntSet individuals, List<? extends AnyInterpretation> interpretations1, ObjectCode code1, 19 IndividualsSet individuals, List<? extends AnyInterpretation> interpretations1, ObjectCode code1,
20 List<? extends AnyInterpretation> interpretations2, ObjectCode code2); 20 List<? extends AnyInterpretation> interpretations2, ObjectCode code2);
21} 21}
diff --git a/subprojects/store/src/main/java/tools/refinery/store/statecoding/internal/StateCoderBuilderImpl.java b/subprojects/store/src/main/java/tools/refinery/store/statecoding/internal/StateCoderBuilderImpl.java
index 36d7d4c7..7fec59c4 100644
--- a/subprojects/store/src/main/java/tools/refinery/store/statecoding/internal/StateCoderBuilderImpl.java
+++ b/subprojects/store/src/main/java/tools/refinery/store/statecoding/internal/StateCoderBuilderImpl.java
@@ -15,7 +15,7 @@ import tools.refinery.store.statecoding.StateCodeCalculatorFactory;
15import tools.refinery.store.statecoding.StateCoderBuilder; 15import tools.refinery.store.statecoding.StateCoderBuilder;
16import tools.refinery.store.statecoding.StateCoderStoreAdapter; 16import tools.refinery.store.statecoding.StateCoderStoreAdapter;
17import tools.refinery.store.statecoding.StateEquivalenceChecker; 17import tools.refinery.store.statecoding.StateEquivalenceChecker;
18import tools.refinery.store.statecoding.neighbourhood.NeighbourhoodCalculator; 18import tools.refinery.store.statecoding.neighborhood.NeighborhoodCalculator;
19import tools.refinery.store.statecoding.stateequivalence.StateEquivalenceCheckerImpl; 19import tools.refinery.store.statecoding.stateequivalence.StateEquivalenceCheckerImpl;
20import tools.refinery.store.tuple.Tuple1; 20import tools.refinery.store.tuple.Tuple1;
21 21
@@ -27,7 +27,7 @@ public class StateCoderBuilderImpl extends AbstractModelAdapterBuilder<StateCode
27 implements StateCoderBuilder { 27 implements StateCoderBuilder {
28 private final Set<AnySymbol> excluded = new HashSet<>(); 28 private final Set<AnySymbol> excluded = new HashSet<>();
29 private final MutableIntSet individuals = IntSets.mutable.empty(); 29 private final MutableIntSet individuals = IntSets.mutable.empty();
30 private StateCodeCalculatorFactory calculator = NeighbourhoodCalculator.factory(); 30 private StateCodeCalculatorFactory calculator = NeighborhoodCalculator.factory();
31 private StateEquivalenceChecker checker = new StateEquivalenceCheckerImpl(); 31 private StateEquivalenceChecker checker = new StateEquivalenceCheckerImpl();
32 32
33 @Override 33 @Override
diff --git a/subprojects/store/src/main/java/tools/refinery/store/statecoding/internal/StateCoderStoreAdapterImpl.java b/subprojects/store/src/main/java/tools/refinery/store/statecoding/internal/StateCoderStoreAdapterImpl.java
index 2cb6f3c1..70beedae 100644
--- a/subprojects/store/src/main/java/tools/refinery/store/statecoding/internal/StateCoderStoreAdapterImpl.java
+++ b/subprojects/store/src/main/java/tools/refinery/store/statecoding/internal/StateCoderStoreAdapterImpl.java
@@ -14,6 +14,8 @@ import tools.refinery.store.statecoding.StateCodeCalculatorFactory;
14import tools.refinery.store.statecoding.StateCoderAdapter; 14import tools.refinery.store.statecoding.StateCoderAdapter;
15import tools.refinery.store.statecoding.StateCoderStoreAdapter; 15import tools.refinery.store.statecoding.StateCoderStoreAdapter;
16import tools.refinery.store.statecoding.StateEquivalenceChecker; 16import tools.refinery.store.statecoding.StateEquivalenceChecker;
17import tools.refinery.store.statecoding.neighborhood.IndividualsSet;
18import tools.refinery.store.statecoding.neighborhood.IndividualsArray;
17 19
18import java.util.Collection; 20import java.util.Collection;
19import java.util.Objects; 21import java.util.Objects;
@@ -21,7 +23,7 @@ import java.util.Objects;
21public class StateCoderStoreAdapterImpl implements StateCoderStoreAdapter { 23public class StateCoderStoreAdapterImpl implements StateCoderStoreAdapter {
22 final ModelStore store; 24 final ModelStore store;
23 final Collection<Symbol<?>> symbols; 25 final Collection<Symbol<?>> symbols;
24 final IntSet individuals; 26 final IndividualsSet individuals;
25 27
26 final StateEquivalenceChecker equivalenceChecker; 28 final StateEquivalenceChecker equivalenceChecker;
27 final StateCodeCalculatorFactory codeCalculatorFactory; 29 final StateCodeCalculatorFactory codeCalculatorFactory;
@@ -36,7 +38,7 @@ public class StateCoderStoreAdapterImpl implements StateCoderStoreAdapter {
36 this.equivalenceChecker = equivalenceChecker; 38 this.equivalenceChecker = equivalenceChecker;
37 this.store = store; 39 this.store = store;
38 this.symbols = symbols; 40 this.symbols = symbols;
39 this.individuals = individuals; 41 this.individuals = new IndividualsArray(individuals.toSortedArray());
40 } 42 }
41 43
42 @Override 44 @Override
diff --git a/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighbourhood/AbstractNeighbourhoodCalculator.java b/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/AbstractNeighborhoodCalculator.java
index a4060e74..fcc1c72d 100644
--- a/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighbourhood/AbstractNeighbourhoodCalculator.java
+++ b/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/AbstractNeighborhoodCalculator.java
@@ -3,11 +3,10 @@
3 * 3 *
4 * SPDX-License-Identifier: EPL-2.0 4 * SPDX-License-Identifier: EPL-2.0
5 */ 5 */
6package tools.refinery.store.statecoding.neighbourhood; 6package tools.refinery.store.statecoding.neighborhood;
7 7
8import org.eclipse.collections.api.factory.primitive.IntLongMaps; 8import org.eclipse.collections.api.factory.primitive.IntLongMaps;
9import org.eclipse.collections.api.map.primitive.MutableIntLongMap; 9import org.eclipse.collections.api.map.primitive.MutableIntLongMap;
10import org.eclipse.collections.api.set.primitive.IntSet;
11import tools.refinery.store.map.Cursor; 10import tools.refinery.store.map.Cursor;
12import tools.refinery.store.model.Model; 11import tools.refinery.store.model.Model;
13import tools.refinery.store.statecoding.ObjectCode; 12import tools.refinery.store.statecoding.ObjectCode;
@@ -17,9 +16,9 @@ import tools.refinery.store.tuple.Tuple;
17 16
18import java.util.*; 17import java.util.*;
19 18
20public abstract class AbstractNeighbourhoodCalculator<T> implements StateCodeCalculator { 19public abstract class AbstractNeighborhoodCalculator<T> implements StateCodeCalculator {
21 private final Model model; 20 private final Model model;
22 private final IntSet individuals; 21 private final IndividualsSet individuals;
23 private final int depth; 22 private final int depth;
24 private List<T> nullImpactValues; 23 private List<T> nullImpactValues;
25 private LinkedHashMap<T, long[]> impactValues; 24 private LinkedHashMap<T, long[]> impactValues;
@@ -29,7 +28,7 @@ public abstract class AbstractNeighbourhoodCalculator<T> implements StateCodeCal
29 28
30 protected static final long PRIME = 31; 29 protected static final long PRIME = 31;
31 30
32 protected AbstractNeighbourhoodCalculator(Model model, IntSet individuals, int depth) { 31 protected AbstractNeighborhoodCalculator(Model model, IndividualsSet individuals, int depth) {
33 this.model = model; 32 this.model = model;
34 this.individuals = individuals; 33 this.individuals = individuals;
35 this.depth = depth; 34 this.depth = depth;
@@ -84,10 +83,7 @@ public abstract class AbstractNeighbourhoodCalculator<T> implements StateCodeCal
84 @SuppressWarnings("squid:S2245") 83 @SuppressWarnings("squid:S2245")
85 Random random = new Random(1); 84 Random random = new Random(1);
86 85
87 var individualsInOrder = individuals.toSortedList(Integer::compare); 86 individuals.stream().forEach(o -> individualHashValues.put(o, random.nextLong()));
88 for (int i = 0; i < individualsInOrder.size(); i++) {
89 individualHashValues.put(individualsInOrder.get(i), random.nextLong());
90 }
91 87
92 for (var interpretation : getInterpretations()) { 88 for (var interpretation : getInterpretations()) {
93 int arity = getArity(interpretation); 89 int arity = getArity(interpretation);
diff --git a/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/IndividualsArray.java b/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/IndividualsArray.java
new file mode 100644
index 00000000..107a01b8
--- /dev/null
+++ b/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/IndividualsArray.java
@@ -0,0 +1,27 @@
1/*
2 * SPDX-FileCopyrightText: 2024 The Refinery Authors <https://refinery.tools/>
3 *
4 * SPDX-License-Identifier: EPL-2.0
5 */
6package tools.refinery.store.statecoding.neighborhood;
7
8import java.util.Arrays;
9import java.util.stream.IntStream;
10
11public class IndividualsArray implements IndividualsSet {
12 private final int[] sortedArray;
13
14 public IndividualsArray(int[] sortedArray) {
15 this.sortedArray = sortedArray;
16 }
17
18 @Override
19 public boolean isIndividual(int nodeId) {
20 return Arrays.binarySearch(sortedArray, nodeId) >= 0;
21 }
22
23 @Override
24 public IntStream stream() {
25 return Arrays.stream(sortedArray);
26 }
27}
diff --git a/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/IndividualsSet.java b/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/IndividualsSet.java
new file mode 100644
index 00000000..059dad41
--- /dev/null
+++ b/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/IndividualsSet.java
@@ -0,0 +1,26 @@
1/*
2 * SPDX-FileCopyrightText: 2024 The Refinery Authors <https://refinery.tools/>
3 *
4 * SPDX-License-Identifier: EPL-2.0
5 */
6package tools.refinery.store.statecoding.neighborhood;
7
8import java.util.stream.IntStream;
9
10public interface IndividualsSet {
11 IndividualsSet EMPTY = new IndividualsSet() {
12 @Override
13 public boolean isIndividual(int nodeId) {
14 return false;
15 }
16
17 @Override
18 public IntStream stream() {
19 return IntStream.empty();
20 }
21 };
22
23 boolean isIndividual(int nodeId);
24
25 IntStream stream();
26}
diff --git a/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighbourhood/NeighbourhoodCalculator.java b/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/NeighborhoodCalculator.java
index 5859ccc2..83ad133d 100644
--- a/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighbourhood/NeighbourhoodCalculator.java
+++ b/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/NeighborhoodCalculator.java
@@ -3,9 +3,8 @@
3 * 3 *
4 * SPDX-License-Identifier: EPL-2.0 4 * SPDX-License-Identifier: EPL-2.0
5 */ 5 */
6package tools.refinery.store.statecoding.neighbourhood; 6package tools.refinery.store.statecoding.neighborhood;
7 7
8import org.eclipse.collections.api.set.primitive.IntSet;
9import tools.refinery.store.map.Cursor; 8import tools.refinery.store.map.Cursor;
10import tools.refinery.store.model.Interpretation; 9import tools.refinery.store.model.Interpretation;
11import tools.refinery.store.model.Model; 10import tools.refinery.store.model.Model;
@@ -14,13 +13,13 @@ import tools.refinery.store.tuple.Tuple;
14 13
15import java.util.List; 14import java.util.List;
16 15
17public class NeighbourhoodCalculator extends AbstractNeighbourhoodCalculator<Interpretation<?>> { 16public class NeighborhoodCalculator extends AbstractNeighborhoodCalculator<Interpretation<?>> {
18 public static final int DEFAULT_DEPTH = 7; 17 public static final int DEFAULT_DEPTH = 7;
19 18
20 private final List<Interpretation<?>> interpretations; 19 private final List<Interpretation<?>> interpretations;
21 20
22 protected NeighbourhoodCalculator(Model model, List<? extends Interpretation<?>> interpretations, 21 protected NeighborhoodCalculator(Model model, List<? extends Interpretation<?>> interpretations,
23 IntSet individuals, int depth) { 22 IndividualsSet individuals, int depth) {
24 super(model, individuals, depth); 23 super(model, individuals, depth);
25 this.interpretations = List.copyOf(interpretations); 24 this.interpretations = List.copyOf(interpretations);
26 } 25 }
@@ -46,7 +45,7 @@ public class NeighbourhoodCalculator extends AbstractNeighbourhoodCalculator<Int
46 } 45 }
47 46
48 public static StateCodeCalculatorFactory factory(int depth) { 47 public static StateCodeCalculatorFactory factory(int depth) {
49 return (model, interpretations, individuals) -> new NeighbourhoodCalculator(model, interpretations, 48 return (model, interpretations, individuals) -> new NeighborhoodCalculator(model, interpretations,
50 individuals, depth); 49 individuals, depth);
51 } 50 }
52 51
diff --git a/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighbourhood/ObjectCodeImpl.java b/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/ObjectCodeImpl.java
index 422e1d73..d6ef2e89 100644
--- a/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighbourhood/ObjectCodeImpl.java
+++ b/subprojects/store/src/main/java/tools/refinery/store/statecoding/neighborhood/ObjectCodeImpl.java
@@ -3,7 +3,7 @@
3 * 3 *
4 * SPDX-License-Identifier: EPL-2.0 4 * SPDX-License-Identifier: EPL-2.0
5 */ 5 */
6package tools.refinery.store.statecoding.neighbourhood; 6package tools.refinery.store.statecoding.neighborhood;
7 7
8import tools.refinery.store.statecoding.ObjectCode; 8import tools.refinery.store.statecoding.ObjectCode;
9 9
diff --git a/subprojects/store/src/main/java/tools/refinery/store/statecoding/stateequivalence/StateEquivalenceCheckerImpl.java b/subprojects/store/src/main/java/tools/refinery/store/statecoding/stateequivalence/StateEquivalenceCheckerImpl.java
index 5a62d8a0..54d6efdc 100644
--- a/subprojects/store/src/main/java/tools/refinery/store/statecoding/stateequivalence/StateEquivalenceCheckerImpl.java
+++ b/subprojects/store/src/main/java/tools/refinery/store/statecoding/stateequivalence/StateEquivalenceCheckerImpl.java
@@ -11,13 +11,13 @@ import org.eclipse.collections.api.factory.primitive.LongObjectMaps;
11import org.eclipse.collections.api.map.primitive.IntIntMap; 11import org.eclipse.collections.api.map.primitive.IntIntMap;
12import org.eclipse.collections.api.map.primitive.MutableIntIntMap; 12import org.eclipse.collections.api.map.primitive.MutableIntIntMap;
13import org.eclipse.collections.api.map.primitive.MutableLongObjectMap; 13import org.eclipse.collections.api.map.primitive.MutableLongObjectMap;
14import org.eclipse.collections.api.set.primitive.IntSet;
15import org.eclipse.collections.api.set.primitive.MutableIntSet; 14import org.eclipse.collections.api.set.primitive.MutableIntSet;
16import tools.refinery.store.model.AnyInterpretation; 15import tools.refinery.store.model.AnyInterpretation;
17import tools.refinery.store.model.Interpretation; 16import tools.refinery.store.model.Interpretation;
18import tools.refinery.store.statecoding.Morphism; 17import tools.refinery.store.statecoding.Morphism;
19import tools.refinery.store.statecoding.ObjectCode; 18import tools.refinery.store.statecoding.ObjectCode;
20import tools.refinery.store.statecoding.StateEquivalenceChecker; 19import tools.refinery.store.statecoding.StateEquivalenceChecker;
20import tools.refinery.store.statecoding.neighborhood.IndividualsSet;
21import tools.refinery.store.tuple.Tuple; 21import tools.refinery.store.tuple.Tuple;
22 22
23import java.util.ArrayList; 23import java.util.ArrayList;
@@ -28,7 +28,7 @@ public class StateEquivalenceCheckerImpl implements StateEquivalenceChecker {
28 public static final int LIMIT = 1000; 28 public static final int LIMIT = 1000;
29 29
30 @Override 30 @Override
31 public EquivalenceResult constructMorphism(IntSet individuals, 31 public EquivalenceResult constructMorphism(IndividualsSet individuals,
32 List<? extends AnyInterpretation> interpretations1, 32 List<? extends AnyInterpretation> interpretations1,
33 ObjectCode code1, 33 ObjectCode code1,
34 List<? extends AnyInterpretation> interpretations2, 34 List<? extends AnyInterpretation> interpretations2,
@@ -67,10 +67,10 @@ public class StateEquivalenceCheckerImpl implements StateEquivalenceChecker {
67 } 67 }
68 } 68 }
69 69
70 private MutableLongObjectMap<MutableIntSet> indexByHash(ObjectCode code, IntSet individuals) { 70 private MutableLongObjectMap<MutableIntSet> indexByHash(ObjectCode code, IndividualsSet individuals) {
71 MutableLongObjectMap<MutableIntSet> result = LongObjectMaps.mutable.empty(); 71 MutableLongObjectMap<MutableIntSet> result = LongObjectMaps.mutable.empty();
72 for (int o = 0; o < code.getSize(); o++) { 72 for (int o = 0; o < code.getSize(); o++) {
73 if (!individuals.contains(o)) { 73 if (!individuals.isIndividual(o)) {
74 long hash = code.get(o); 74 long hash = code.get(o);
75 if (hash != 0) { 75 if (hash != 0) {
76 var equivalenceClass = result.get(hash); 76 var equivalenceClass = result.get(hash);
@@ -86,8 +86,9 @@ public class StateEquivalenceCheckerImpl implements StateEquivalenceChecker {
86 } 86 }
87 87
88 private EquivalenceResult constructPermutationNavigation( 88 private EquivalenceResult constructPermutationNavigation(
89 IntSet individuals, MutableLongObjectMap<MutableIntSet> map1, MutableLongObjectMap<MutableIntSet> map2, 89 IndividualsSet individuals, MutableLongObjectMap<MutableIntSet> map1,
90 MutableIntIntMap object2OptionIndex, List<List<IntIntMap>> listOfOptions) { 90 MutableLongObjectMap<MutableIntSet> map2, MutableIntIntMap object2OptionIndex,
91 List<List<IntIntMap>> listOfOptions) {
91 if (map1.size() != map2.size()) { 92 if (map1.size() != map2.size()) {
92 return EquivalenceResult.DIFFERENT; 93 return EquivalenceResult.DIFFERENT;
93 } 94 }
@@ -116,7 +117,7 @@ public class StateEquivalenceCheckerImpl implements StateEquivalenceChecker {
116 listOfOptions.add(pairing.permutations()); 117 listOfOptions.add(pairing.permutations());
117 } 118 }
118 119
119 individuals.forEach(o -> listOfOptions.add(o, List.of(IntIntMaps.immutable.of(o, o)))); 120 individuals.stream().forEach(o -> listOfOptions.add(o, List.of(IntIntMaps.immutable.of(o, o))));
120 121
121 if (allComplete) { 122 if (allComplete) {
122 return EquivalenceResult.ISOMORPHIC; 123 return EquivalenceResult.ISOMORPHIC;
diff --git a/subprojects/store/src/test/java/tools/refinery/store/statecoding/EquivalenceTest.java b/subprojects/store/src/test/java/tools/refinery/store/statecoding/EquivalenceTest.java
index f2d2f7b5..31726133 100644
--- a/subprojects/store/src/test/java/tools/refinery/store/statecoding/EquivalenceTest.java
+++ b/subprojects/store/src/test/java/tools/refinery/store/statecoding/EquivalenceTest.java
@@ -10,7 +10,7 @@ import tools.refinery.store.map.Version;
10import tools.refinery.store.model.Model; 10import tools.refinery.store.model.Model;
11import tools.refinery.store.model.ModelStore; 11import tools.refinery.store.model.ModelStore;
12import tools.refinery.store.representation.Symbol; 12import tools.refinery.store.representation.Symbol;
13import tools.refinery.store.statecoding.neighbourhood.ObjectCodeImpl; 13import tools.refinery.store.statecoding.neighborhood.ObjectCodeImpl;
14import tools.refinery.store.tuple.Tuple; 14import tools.refinery.store.tuple.Tuple;
15 15
16import static org.junit.jupiter.api.Assertions.assertEquals; 16import static org.junit.jupiter.api.Assertions.assertEquals;