diff options
Diffstat (limited to 'language-model/src')
-rw-r--r-- | language-model/src/testFixtures/java/tools/refinery/language/model/tests/ProblemTestUtil.java | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/language-model/src/testFixtures/java/tools/refinery/language/model/tests/ProblemTestUtil.java b/language-model/src/testFixtures/java/tools/refinery/language/model/tests/ProblemTestUtil.java index b412ed1f..dadc5330 100644 --- a/language-model/src/testFixtures/java/tools/refinery/language/model/tests/ProblemTestUtil.java +++ b/language-model/src/testFixtures/java/tools/refinery/language/model/tests/ProblemTestUtil.java | |||
@@ -7,26 +7,33 @@ import org.eclipse.emf.ecore.resource.Resource.Diagnostic; | |||
7 | import org.eclipse.emf.ecore.util.EcoreUtil; | 7 | import org.eclipse.emf.ecore.util.EcoreUtil; |
8 | 8 | ||
9 | import tools.refinery.language.model.ProblemUtil; | 9 | import tools.refinery.language.model.ProblemUtil; |
10 | import tools.refinery.language.model.problem.ActionLiteral; | ||
10 | import tools.refinery.language.model.problem.Argument; | 11 | import tools.refinery.language.model.problem.Argument; |
11 | import tools.refinery.language.model.problem.Assertion; | 12 | import tools.refinery.language.model.problem.Assertion; |
12 | import tools.refinery.language.model.problem.AssertionArgument; | 13 | import tools.refinery.language.model.problem.AssertionArgument; |
13 | import tools.refinery.language.model.problem.Atom; | 14 | import tools.refinery.language.model.problem.Atom; |
14 | import tools.refinery.language.model.problem.ClassDeclaration; | 15 | import tools.refinery.language.model.problem.ClassDeclaration; |
15 | import tools.refinery.language.model.problem.Conjunction; | 16 | import tools.refinery.language.model.problem.Conjunction; |
17 | import tools.refinery.language.model.problem.DeleteActionLiteral; | ||
16 | import tools.refinery.language.model.problem.EnumDeclaration; | 18 | import tools.refinery.language.model.problem.EnumDeclaration; |
17 | import tools.refinery.language.model.problem.Literal; | 19 | import tools.refinery.language.model.problem.Literal; |
18 | import tools.refinery.language.model.problem.NamedElement; | 20 | import tools.refinery.language.model.problem.NamedElement; |
19 | import tools.refinery.language.model.problem.NegativeLiteral; | 21 | import tools.refinery.language.model.problem.NegativeLiteral; |
22 | import tools.refinery.language.model.problem.NewActionLiteral; | ||
20 | import tools.refinery.language.model.problem.Node; | 23 | import tools.refinery.language.model.problem.Node; |
21 | import tools.refinery.language.model.problem.NodeAssertionArgument; | 24 | import tools.refinery.language.model.problem.NodeAssertionArgument; |
22 | import tools.refinery.language.model.problem.NodeValueAssertion; | 25 | import tools.refinery.language.model.problem.NodeValueAssertion; |
23 | import tools.refinery.language.model.problem.Parameter; | 26 | import tools.refinery.language.model.problem.Parameter; |
27 | import tools.refinery.language.model.problem.ParametricDefinition; | ||
24 | import tools.refinery.language.model.problem.PredicateDefinition; | 28 | import tools.refinery.language.model.problem.PredicateDefinition; |
25 | import tools.refinery.language.model.problem.Problem; | 29 | import tools.refinery.language.model.problem.Problem; |
26 | import tools.refinery.language.model.problem.ReferenceDeclaration; | 30 | import tools.refinery.language.model.problem.ReferenceDeclaration; |
27 | import tools.refinery.language.model.problem.Relation; | 31 | import tools.refinery.language.model.problem.Relation; |
32 | import tools.refinery.language.model.problem.RuleDefinition; | ||
28 | import tools.refinery.language.model.problem.Statement; | 33 | import tools.refinery.language.model.problem.Statement; |
29 | import tools.refinery.language.model.problem.UniqueDeclaration; | 34 | import tools.refinery.language.model.problem.UniqueDeclaration; |
35 | import tools.refinery.language.model.problem.ValueActionLiteral; | ||
36 | import tools.refinery.language.model.problem.ValueLiteral; | ||
30 | import tools.refinery.language.model.problem.Variable; | 37 | import tools.refinery.language.model.problem.Variable; |
31 | import tools.refinery.language.model.problem.VariableOrNode; | 38 | import tools.refinery.language.model.problem.VariableOrNode; |
32 | import tools.refinery.language.model.problem.VariableOrNodeArgument; | 39 | import tools.refinery.language.model.problem.VariableOrNodeArgument; |
@@ -49,17 +56,29 @@ public class ProblemTestUtil { | |||
49 | return namedStatementOfType(problem, PredicateDefinition.class, name); | 56 | return namedStatementOfType(problem, PredicateDefinition.class, name); |
50 | } | 57 | } |
51 | 58 | ||
52 | public Parameter param(PredicateDefinition definition, int i) { | 59 | public RuleDefinition rule(Problem problem, String name) { |
60 | return namedStatementOfType(problem, RuleDefinition.class, name); | ||
61 | } | ||
62 | |||
63 | public Parameter param(ParametricDefinition definition, int i) { | ||
53 | return definition.getParameters().get(i); | 64 | return definition.getParameters().get(i); |
54 | } | 65 | } |
55 | 66 | ||
56 | public Conjunction conj(PredicateDefinition definition, int i) { | 67 | public Conjunction conj(ParametricDefinition definition, int i) { |
57 | return definition.getBodies().get(i); | 68 | return definition.getBodies().get(i); |
58 | } | 69 | } |
59 | 70 | ||
60 | public Literal lit(Conjunction conjunction, int i) { | 71 | public Literal lit(Conjunction conjunction, int i) { |
61 | return conjunction.getLiterals().get(i); | 72 | return conjunction.getLiterals().get(i); |
62 | } | 73 | } |
74 | |||
75 | public ActionLiteral actionLit(RuleDefinition rule, int i) { | ||
76 | return rule.getAction().getActionLiterals().get(i); | ||
77 | } | ||
78 | |||
79 | public Atom valueAtom(Literal literal) { | ||
80 | return ((ValueLiteral) literal).getAtom(); | ||
81 | } | ||
63 | 82 | ||
64 | public Atom negated(Literal literal) { | 83 | public Atom negated(Literal literal) { |
65 | return ((NegativeLiteral) literal).getAtom(); | 84 | return ((NegativeLiteral) literal).getAtom(); |
@@ -85,6 +104,30 @@ public class ProblemTestUtil { | |||
85 | return (Variable) variableOrNode(argument); | 104 | return (Variable) variableOrNode(argument); |
86 | } | 105 | } |
87 | 106 | ||
107 | public Variable variable(ValueActionLiteral valueActionLiteral, int i) { | ||
108 | return variable(arg(valueActionLiteral.getAtom(), i)); | ||
109 | } | ||
110 | |||
111 | public Variable variable(NewActionLiteral newActionLiteral) { | ||
112 | return newActionLiteral.getVariable(); | ||
113 | } | ||
114 | |||
115 | public VariableOrNode deleteVar(ActionLiteral actionLiteral) { | ||
116 | return ((DeleteActionLiteral) actionLiteral).getVariableOrNode(); | ||
117 | } | ||
118 | |||
119 | public VariableOrNode newVar(ActionLiteral actionLiteral) { | ||
120 | return ((NewActionLiteral) actionLiteral).getVariable(); | ||
121 | } | ||
122 | |||
123 | public Atom valueAtom(ActionLiteral actionLiteral) { | ||
124 | return ((ValueActionLiteral) actionLiteral).getAtom(); | ||
125 | } | ||
126 | |||
127 | public Variable variable(DeleteActionLiteral deleteActionLiteral) { | ||
128 | return (Variable) deleteActionLiteral.getVariableOrNode(); | ||
129 | } | ||
130 | |||
88 | public Node node(Argument argument) { | 131 | public Node node(Argument argument) { |
89 | return (Node) variableOrNode(argument); | 132 | return (Node) variableOrNode(argument); |
90 | } | 133 | } |