blob: eafb5c56a4228858068bb64203cb3afbb2cda4e8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package org.eclipse.viatra.solver.data.model.representation;
import org.eclipse.viatra.solver.data.model.Tuple;
import org.eclipse.viatra.solver.data.model.TupleHashProvider;
public class Relation<D> extends DataRepresentation<Tuple, D> {
private final String name;
private final int arity;
public Relation(String name, int arity, D defaultValue) {
super(TupleHashProvider.singleton(), defaultValue);
this.name = name;
this.arity = arity;
}
@Override
public String getName() {
return name;
}
public int getArity() {
return arity;
}
@Override
public boolean isValidKey(Tuple key) {
if(key == null) {
return false;
} else return key.getSize() == getArity();
}
}
|