diff options
author | 2021-08-16 01:46:18 +0200 | |
---|---|---|
committer | 2021-08-16 01:46:18 +0200 | |
commit | ee42d317388514082dd45bb8a1de7f451f5b4767 (patch) | |
tree | 60a2764a2719f7c61a4d7261281f4def89aadca0 /model-data | |
parent | Updated gradle build for viatra. (diff) | |
download | refinery-ee42d317388514082dd45bb8a1de7f451f5b4767.tar.gz refinery-ee42d317388514082dd45bb8a1de7f451f5b4767.tar.zst refinery-ee42d317388514082dd45bb8a1de7f451f5b4767.zip |
Removed data reference to domain classes
Diffstat (limited to 'model-data')
4 files changed, 9 insertions, 26 deletions
diff --git a/model-data/src/main/java/org/eclipse/viatra/solver/data/model/internal/SimilarRelationEquivalenceClass.java b/model-data/src/main/java/org/eclipse/viatra/solver/data/model/internal/SimilarRelationEquivalenceClass.java index dbe77662..7054e4db 100644 --- a/model-data/src/main/java/org/eclipse/viatra/solver/data/model/internal/SimilarRelationEquivalenceClass.java +++ b/model-data/src/main/java/org/eclipse/viatra/solver/data/model/internal/SimilarRelationEquivalenceClass.java | |||
@@ -8,29 +8,26 @@ import org.eclipse.viatra.solver.data.model.representation.Relation; | |||
8 | 8 | ||
9 | public class SimilarRelationEquivalenceClass { | 9 | public class SimilarRelationEquivalenceClass { |
10 | final ContinousHashProvider<Tuple> hashProvider; | 10 | final ContinousHashProvider<Tuple> hashProvider; |
11 | final Class<?> domainClass; | ||
12 | final Object defaultValue; | 11 | final Object defaultValue; |
13 | final int arity; | 12 | final int arity; |
14 | public SimilarRelationEquivalenceClass(Relation<?> representation) { | 13 | public SimilarRelationEquivalenceClass(Relation<?> representation) { |
15 | this.hashProvider = representation.getHashProvider(); | 14 | this.hashProvider = representation.getHashProvider(); |
16 | this.domainClass = representation.getValueClass(); | ||
17 | this.defaultValue = representation.getDefaultValue(); | 15 | this.defaultValue = representation.getDefaultValue(); |
18 | this.arity = representation.getArity(); | 16 | this.arity = representation.getArity(); |
19 | } | 17 | } |
20 | @Override | 18 | @Override |
21 | public int hashCode() { | 19 | public int hashCode() { |
22 | return Objects.hash(arity, defaultValue, domainClass, hashProvider); | 20 | return Objects.hash(arity, defaultValue, hashProvider); |
23 | } | 21 | } |
24 | @Override | 22 | @Override |
25 | public boolean equals(Object obj) { | 23 | public boolean equals(Object obj) { |
26 | if (this == obj) | 24 | if (this == obj) |
27 | return true; | 25 | return true; |
28 | if (obj == null) | 26 | if (!(obj instanceof SimilarRelationEquivalenceClass)) |
29 | return false; | ||
30 | if (getClass() != obj.getClass()) | ||
31 | return false; | 27 | return false; |
32 | SimilarRelationEquivalenceClass other = (SimilarRelationEquivalenceClass) obj; | 28 | SimilarRelationEquivalenceClass other = (SimilarRelationEquivalenceClass) obj; |
33 | return arity == other.arity && Objects.equals(defaultValue, other.defaultValue) | 29 | return arity == other.arity && Objects.equals(defaultValue, other.defaultValue) |
34 | && Objects.equals(domainClass, other.domainClass) && Objects.equals(hashProvider, other.hashProvider); | 30 | && Objects.equals(hashProvider, other.hashProvider); |
35 | } | 31 | } |
32 | |||
36 | } | 33 | } |
diff --git a/model-data/src/main/java/org/eclipse/viatra/solver/data/model/representation/AuxilaryData.java b/model-data/src/main/java/org/eclipse/viatra/solver/data/model/representation/AuxilaryData.java index 05715027..7fc79348 100644 --- a/model-data/src/main/java/org/eclipse/viatra/solver/data/model/representation/AuxilaryData.java +++ b/model-data/src/main/java/org/eclipse/viatra/solver/data/model/representation/AuxilaryData.java | |||
@@ -5,9 +5,8 @@ import org.eclipse.viatra.solver.data.map.ContinousHashProvider; | |||
5 | public class AuxilaryData<K,V> extends DataRepresentation<K, V> { | 5 | public class AuxilaryData<K,V> extends DataRepresentation<K, V> { |
6 | private final String name; | 6 | private final String name; |
7 | 7 | ||
8 | public AuxilaryData(String name, Class<K> keyClass, ContinousHashProvider<K> hashProvider, Class<V> valueClass, | 8 | public AuxilaryData(String name, ContinousHashProvider<K> hashProvider, V defaultValue) { |
9 | V defaultValue) { | 9 | super(hashProvider, defaultValue); |
10 | super(keyClass, hashProvider, valueClass, defaultValue); | ||
11 | this.name = name; | 10 | this.name = name; |
12 | } | 11 | } |
13 | 12 | ||
diff --git a/model-data/src/main/java/org/eclipse/viatra/solver/data/model/representation/DataRepresentation.java b/model-data/src/main/java/org/eclipse/viatra/solver/data/model/representation/DataRepresentation.java index 28d8e2fb..fd48eb94 100644 --- a/model-data/src/main/java/org/eclipse/viatra/solver/data/model/representation/DataRepresentation.java +++ b/model-data/src/main/java/org/eclipse/viatra/solver/data/model/representation/DataRepresentation.java | |||
@@ -3,29 +3,16 @@ package org.eclipse.viatra.solver.data.model.representation; | |||
3 | import org.eclipse.viatra.solver.data.map.ContinousHashProvider; | 3 | import org.eclipse.viatra.solver.data.map.ContinousHashProvider; |
4 | 4 | ||
5 | public abstract class DataRepresentation<K, V> { | 5 | public abstract class DataRepresentation<K, V> { |
6 | protected final Class<K> keyClass; | ||
7 | protected final Class<V> valueClass; | ||
8 | protected final ContinousHashProvider<K> hashProvider; | 6 | protected final ContinousHashProvider<K> hashProvider; |
9 | protected final V defaultValue; | 7 | protected final V defaultValue; |
10 | 8 | ||
11 | protected DataRepresentation(Class<K> keyClass, ContinousHashProvider<K> hashProvider, Class<V> valueClass, | 9 | protected DataRepresentation(ContinousHashProvider<K> hashProvider, V defaultValue) { |
12 | V defaultValue) { | ||
13 | this.keyClass = keyClass; | ||
14 | this.hashProvider = hashProvider; | 10 | this.hashProvider = hashProvider; |
15 | this.valueClass = valueClass; | ||
16 | this.defaultValue = defaultValue; | 11 | this.defaultValue = defaultValue; |
17 | } | 12 | } |
18 | 13 | ||
19 | public abstract String getName(); | 14 | public abstract String getName(); |
20 | 15 | ||
21 | public Class<K> getKeyClass() { | ||
22 | return keyClass; | ||
23 | } | ||
24 | |||
25 | public Class<V> getValueClass() { | ||
26 | return valueClass; | ||
27 | } | ||
28 | |||
29 | public ContinousHashProvider<K> getHashProvider() { | 16 | public ContinousHashProvider<K> getHashProvider() { |
30 | return hashProvider; | 17 | return hashProvider; |
31 | } | 18 | } |
diff --git a/model-data/src/main/java/org/eclipse/viatra/solver/data/model/representation/Relation.java b/model-data/src/main/java/org/eclipse/viatra/solver/data/model/representation/Relation.java index 601ee118..79bd9661 100644 --- a/model-data/src/main/java/org/eclipse/viatra/solver/data/model/representation/Relation.java +++ b/model-data/src/main/java/org/eclipse/viatra/solver/data/model/representation/Relation.java | |||
@@ -7,8 +7,8 @@ public class Relation<D> extends DataRepresentation<Tuple, D> { | |||
7 | private final String name; | 7 | private final String name; |
8 | private final int arity; | 8 | private final int arity; |
9 | 9 | ||
10 | public Relation(String name, int arity, Class<D> domain, D defaultValue) { | 10 | public Relation(String name, int arity, D defaultValue) { |
11 | super(Tuple.class, TupleHashProvider.singleton(), domain, defaultValue); | 11 | super(TupleHashProvider.singleton(), defaultValue); |
12 | this.name = name; | 12 | this.name = name; |
13 | this.arity = arity; | 13 | this.arity = arity; |
14 | } | 14 | } |