diff options
Diffstat (limited to 'store/src/main/java/org/eclipse/viatra/solver/data/model/representation')
4 files changed, 0 insertions, 128 deletions
diff --git a/store/src/main/java/org/eclipse/viatra/solver/data/model/representation/AuxilaryData.java b/store/src/main/java/org/eclipse/viatra/solver/data/model/representation/AuxilaryData.java deleted file mode 100644 index 7fc79348..00000000 --- a/store/src/main/java/org/eclipse/viatra/solver/data/model/representation/AuxilaryData.java +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | package org.eclipse.viatra.solver.data.model.representation; | ||
2 | |||
3 | import org.eclipse.viatra.solver.data.map.ContinousHashProvider; | ||
4 | |||
5 | public class AuxilaryData<K,V> extends DataRepresentation<K, V> { | ||
6 | private final String name; | ||
7 | |||
8 | public AuxilaryData(String name, ContinousHashProvider<K> hashProvider, V defaultValue) { | ||
9 | super(hashProvider, defaultValue); | ||
10 | this.name = name; | ||
11 | } | ||
12 | |||
13 | @Override | ||
14 | public String getName() { | ||
15 | return name; | ||
16 | } | ||
17 | |||
18 | @Override | ||
19 | public boolean isValidKey(K key) { | ||
20 | return true; | ||
21 | } | ||
22 | } | ||
diff --git a/store/src/main/java/org/eclipse/viatra/solver/data/model/representation/DataRepresentation.java b/store/src/main/java/org/eclipse/viatra/solver/data/model/representation/DataRepresentation.java deleted file mode 100644 index fd48eb94..00000000 --- a/store/src/main/java/org/eclipse/viatra/solver/data/model/representation/DataRepresentation.java +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | package org.eclipse.viatra.solver.data.model.representation; | ||
2 | |||
3 | import org.eclipse.viatra.solver.data.map.ContinousHashProvider; | ||
4 | |||
5 | public abstract class DataRepresentation<K, V> { | ||
6 | protected final ContinousHashProvider<K> hashProvider; | ||
7 | protected final V defaultValue; | ||
8 | |||
9 | protected DataRepresentation(ContinousHashProvider<K> hashProvider, V defaultValue) { | ||
10 | this.hashProvider = hashProvider; | ||
11 | this.defaultValue = defaultValue; | ||
12 | } | ||
13 | |||
14 | public abstract String getName(); | ||
15 | |||
16 | public ContinousHashProvider<K> getHashProvider() { | ||
17 | return hashProvider; | ||
18 | } | ||
19 | public abstract boolean isValidKey(K key); | ||
20 | |||
21 | public V getDefaultValue() { | ||
22 | return defaultValue; | ||
23 | } | ||
24 | } | ||
diff --git a/store/src/main/java/org/eclipse/viatra/solver/data/model/representation/Relation.java b/store/src/main/java/org/eclipse/viatra/solver/data/model/representation/Relation.java deleted file mode 100644 index eafb5c56..00000000 --- a/store/src/main/java/org/eclipse/viatra/solver/data/model/representation/Relation.java +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | package org.eclipse.viatra.solver.data.model.representation; | ||
2 | |||
3 | import org.eclipse.viatra.solver.data.model.Tuple; | ||
4 | import org.eclipse.viatra.solver.data.model.TupleHashProvider; | ||
5 | |||
6 | public class Relation<D> extends DataRepresentation<Tuple, D> { | ||
7 | private final String name; | ||
8 | private final int arity; | ||
9 | |||
10 | public Relation(String name, int arity, D defaultValue) { | ||
11 | super(TupleHashProvider.singleton(), defaultValue); | ||
12 | this.name = name; | ||
13 | this.arity = arity; | ||
14 | } | ||
15 | |||
16 | @Override | ||
17 | public String getName() { | ||
18 | return name; | ||
19 | } | ||
20 | |||
21 | public int getArity() { | ||
22 | return arity; | ||
23 | } | ||
24 | |||
25 | @Override | ||
26 | public boolean isValidKey(Tuple key) { | ||
27 | if(key == null) { | ||
28 | return false; | ||
29 | } else return key.getSize() == getArity(); | ||
30 | } | ||
31 | } | ||
diff --git a/store/src/main/java/org/eclipse/viatra/solver/data/model/representation/TruthValue.java b/store/src/main/java/org/eclipse/viatra/solver/data/model/representation/TruthValue.java deleted file mode 100644 index 049c7eac..00000000 --- a/store/src/main/java/org/eclipse/viatra/solver/data/model/representation/TruthValue.java +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | package org.eclipse.viatra.solver.data.model.representation; | ||
2 | |||
3 | public enum TruthValue { | ||
4 | TRUE("true"), | ||
5 | |||
6 | FALSE("false"), | ||
7 | |||
8 | UNKNOWN("unknown"), | ||
9 | |||
10 | ERROR("error"); | ||
11 | |||
12 | private final String name; | ||
13 | |||
14 | private TruthValue(String name) { | ||
15 | this.name = name; | ||
16 | } | ||
17 | |||
18 | public String getName() { | ||
19 | return name; | ||
20 | } | ||
21 | |||
22 | public static TruthValue toTruthValue(boolean value) { | ||
23 | return value ? TRUE : FALSE; | ||
24 | } | ||
25 | |||
26 | public boolean isConsistent() { | ||
27 | return this != ERROR; | ||
28 | } | ||
29 | |||
30 | public boolean isComplete() { | ||
31 | return this != UNKNOWN; | ||
32 | } | ||
33 | |||
34 | public boolean must() { | ||
35 | return this == TRUE || this == ERROR; | ||
36 | } | ||
37 | |||
38 | public boolean may() { | ||
39 | return this == TRUE || this == UNKNOWN; | ||
40 | } | ||
41 | |||
42 | public TruthValue not() { | ||
43 | if (this == TRUE) { | ||
44 | return FALSE; | ||
45 | } else if (this == FALSE) { | ||
46 | return TRUE; | ||
47 | } else { | ||
48 | return this; | ||
49 | } | ||
50 | } | ||
51 | } | ||