blob: 47a075365513f81c1d1a302f8dc8b47b476c2cd2 (
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
32
33
|
package tools.refinery.store.model.representation;
import tools.refinery.store.map.ContinousHashProvider;
import tools.refinery.store.model.TupleHashProvider;
import tools.refinery.store.tuple.Tuple;
public final class Relation<D> extends DataRepresentation<Tuple, D> implements AnyRelation {
private final int arity;
public Relation(String name, int arity, Class<D> valueType, D defaultValue) {
super(name, Tuple.class, valueType, defaultValue);
this.arity = arity;
}
@Override
public int getArity() {
return arity;
}
@Override
public ContinousHashProvider<Tuple> getHashProvider() {
return TupleHashProvider.singleton();
}
@Override
public boolean isValidKey(Tuple key) {
if (key == null) {
return false;
} else {
return key.getSize() == getArity();
}
}
}
|