diff options
Diffstat (limited to 'model-data/src/main/java/org/eclipse/viatra/solver/data/model/representation/Relation.java')
-rw-r--r-- | model-data/src/main/java/org/eclipse/viatra/solver/data/model/representation/Relation.java | 17 |
1 files changed, 9 insertions, 8 deletions
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 28d00b2a..601ee118 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 | |||
@@ -2,27 +2,28 @@ package org.eclipse.viatra.solver.data.model.representation; | |||
2 | 2 | ||
3 | import org.eclipse.viatra.solver.data.model.Tuple; | 3 | import org.eclipse.viatra.solver.data.model.Tuple; |
4 | import org.eclipse.viatra.solver.data.model.TupleHashProvider; | 4 | import org.eclipse.viatra.solver.data.model.TupleHashProvider; |
5 | import org.eclipse.viatra.solver.data.model.symbols.Symbol; | ||
6 | 5 | ||
7 | public class Relation<D> extends DataRepresentation<Tuple, D> { | 6 | public class Relation<D> extends DataRepresentation<Tuple, D> { |
8 | private final Symbol symbol; | 7 | private final String name; |
8 | private final int arity; | ||
9 | 9 | ||
10 | public Relation(Symbol symbol, Class<D> domain, D defaultValue) { | 10 | public Relation(String name, int arity, Class<D> domain, D defaultValue) { |
11 | super(Tuple.class, TupleHashProvider.singleton(), domain, defaultValue); | 11 | super(Tuple.class, TupleHashProvider.singleton(), domain, defaultValue); |
12 | this.symbol = symbol; | 12 | this.name = name; |
13 | this.arity = arity; | ||
13 | } | 14 | } |
14 | 15 | ||
15 | @Override | 16 | @Override |
16 | public String getName() { | 17 | public String getName() { |
17 | return symbol.getName(); | 18 | return name; |
18 | } | 19 | } |
19 | 20 | ||
20 | public Symbol getSymbol() { | 21 | public int getArity() { |
21 | return symbol; | 22 | return arity; |
22 | } | 23 | } |
23 | 24 | ||
24 | @Override | 25 | @Override |
25 | public boolean isValidKey(Tuple key) { | 26 | public boolean isValidKey(Tuple key) { |
26 | return key.getSize() == symbol.getArity(); | 27 | return key.getSize() == getArity(); |
27 | } | 28 | } |
28 | } | 29 | } |