blob: de500fc9eb788339a23d129c31b452b2a1909cd7 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
package org.eclipse.viatra.solver.data.query.internal;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.eclipse.viatra.query.runtime.matchers.context.AbstractQueryMetaContext;
import org.eclipse.viatra.query.runtime.matchers.context.IInputKey;
import org.eclipse.viatra.query.runtime.matchers.context.InputKeyImplication;
import org.eclipse.viatra.solver.data.query.view.RelationView;
/**
* The meta context information for String scopes.
*/
public final class RelationalQueryMetaContext extends AbstractQueryMetaContext {
@Override
public boolean isEnumerable(IInputKey key) {
ensureValidKey(key);
return key.isEnumerable();
}
@Override
public boolean isStateless(IInputKey key) {
ensureValidKey(key);
return key instanceof RelationView<?>;
}
@Override
public Collection<InputKeyImplication> getImplications(IInputKey implyingKey) {
ensureValidKey(implyingKey);
return new HashSet<InputKeyImplication>();
}
@Override
public Map<Set<Integer>, Set<Integer>> getFunctionalDependencies(IInputKey key) {
ensureValidKey(key);
if (key instanceof RelationView) {
return new HashMap<Set<Integer>, Set<Integer>>();
} else {
return Collections.emptyMap();
}
}
public void ensureValidKey(IInputKey key) {
if (! (key instanceof RelationView<?>))
illegalInputKey(key);
}
public void illegalInputKey(IInputKey key) {
throw new IllegalArgumentException("The input key " + key + " is not a valid input key.");
}
}
|