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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
/*
* generated by Xtext 2.26.0.M1
*/
package org.eclipse.viatra.solver.language.serializer;
import com.google.inject.Inject;
import java.util.Set;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.viatra.solver.language.model.problem.Assertion;
import org.eclipse.viatra.solver.language.model.problem.Atom;
import org.eclipse.viatra.solver.language.model.problem.ClassDeclaration;
import org.eclipse.viatra.solver.language.model.problem.Conjunction;
import org.eclipse.viatra.solver.language.model.problem.ExactMultiplicity;
import org.eclipse.viatra.solver.language.model.problem.NegativeLiteral;
import org.eclipse.viatra.solver.language.model.problem.PredicateDefinition;
import org.eclipse.viatra.solver.language.model.problem.Problem;
import org.eclipse.viatra.solver.language.model.problem.ProblemPackage;
import org.eclipse.viatra.solver.language.model.problem.RangeMultiplicity;
import org.eclipse.viatra.solver.language.model.problem.ReferenceDeclaration;
import org.eclipse.viatra.solver.language.model.problem.ScopeDeclaration;
import org.eclipse.viatra.solver.language.model.problem.TypeScope;
import org.eclipse.viatra.solver.language.services.ProblemGrammarAccess;
import org.eclipse.xtext.Action;
import org.eclipse.xtext.Parameter;
import org.eclipse.xtext.ParserRule;
import org.eclipse.xtext.serializer.ISerializationContext;
import org.eclipse.xtext.serializer.acceptor.SequenceFeeder;
import org.eclipse.xtext.serializer.sequencer.AbstractDelegatingSemanticSequencer;
import org.eclipse.xtext.serializer.sequencer.ITransientValueService.ValueTransient;
@SuppressWarnings("all")
public class ProblemSemanticSequencer extends AbstractDelegatingSemanticSequencer {
@Inject
private ProblemGrammarAccess grammarAccess;
@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
EPackage epackage = semanticObject.eClass().getEPackage();
ParserRule rule = context.getParserRule();
Action action = context.getAssignedAction();
Set<Parameter> parameters = context.getEnabledBooleanParameters();
if (epackage == ProblemPackage.eINSTANCE)
switch (semanticObject.eClass().getClassifierID()) {
case ProblemPackage.ASSERTION:
sequence_Assertion(context, (Assertion) semanticObject);
return;
case ProblemPackage.ATOM:
sequence_Atom(context, (Atom) semanticObject);
return;
case ProblemPackage.CLASS_DECLARATION:
sequence_ClassDeclaration(context, (ClassDeclaration) semanticObject);
return;
case ProblemPackage.CONJUNCTION:
sequence_Conjunction(context, (Conjunction) semanticObject);
return;
case ProblemPackage.EXACT_MULTIPLICITY:
sequence_ExactMultiplicity(context, (ExactMultiplicity) semanticObject);
return;
case ProblemPackage.NEGATIVE_LITERAL:
sequence_NegativeLiteral(context, (NegativeLiteral) semanticObject);
return;
case ProblemPackage.PARAMETER:
sequence_Parameter(context, (org.eclipse.viatra.solver.language.model.problem.Parameter) semanticObject);
return;
case ProblemPackage.PREDICATE_DEFINITION:
sequence_PredicateDefinition(context, (PredicateDefinition) semanticObject);
return;
case ProblemPackage.PROBLEM:
sequence_Problem(context, (Problem) semanticObject);
return;
case ProblemPackage.RANGE_MULTIPLICITY:
sequence_RangeMultiplicity(context, (RangeMultiplicity) semanticObject);
return;
case ProblemPackage.REFERENCE_DECLARATION:
sequence_ReferenceDeclaration(context, (ReferenceDeclaration) semanticObject);
return;
case ProblemPackage.SCOPE_DECLARATION:
sequence_ScopeDeclaration(context, (ScopeDeclaration) semanticObject);
return;
case ProblemPackage.TYPE_SCOPE:
sequence_TypeScope(context, (TypeScope) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
/**
* Contexts:
* Statement returns Assertion
* Assertion returns Assertion
*
* Constraint:
* (
* (relation=[Relation|QualifiedName] (arguments+=[Node|QualifiedName] arguments+=[Node|QualifiedName]*)? value=LogicValue) |
* (value=ShortLogicValue? relation=[Relation|QualifiedName] (arguments+=[Node|QualifiedName] arguments+=[Node|QualifiedName]*)?)
* )
*/
protected void sequence_Assertion(ISerializationContext context, Assertion semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Contexts:
* Literal returns Atom
* Atom returns Atom
*
* Constraint:
* (relation=[Relation|QualifiedName] transitiveClosure?='+'? (arguments+=[Variable|ID] arguments+=[Variable|ID]*)?)
*/
protected void sequence_Atom(ISerializationContext context, Atom semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Contexts:
* Statement returns ClassDeclaration
* ClassDeclaration returns ClassDeclaration
*
* Constraint:
* (
* abstract?='abstract'?
* name=ID
* (
* superTypes+=[ClassDeclaration|ID] |
* (superTypes+=[ClassDeclaration|ID] superTypes+=[ClassDeclaration|ID]*) |
* referenceDeclarations+=ReferenceDeclaration
* )?
* referenceDeclarations+=ReferenceDeclaration*
* )
*/
protected void sequence_ClassDeclaration(ISerializationContext context, ClassDeclaration semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Contexts:
* Conjunction returns Conjunction
*
* Constraint:
* (literals+=Literal literals+=Literal*)
*/
protected void sequence_Conjunction(ISerializationContext context, Conjunction semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Contexts:
* Multiplicity returns ExactMultiplicity
* ExactMultiplicity returns ExactMultiplicity
*
* Constraint:
* exactValue=INT
*/
protected void sequence_ExactMultiplicity(ISerializationContext context, ExactMultiplicity semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, ProblemPackage.Literals.EXACT_MULTIPLICITY__EXACT_VALUE) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ProblemPackage.Literals.EXACT_MULTIPLICITY__EXACT_VALUE));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getExactMultiplicityAccess().getExactValueINTTerminalRuleCall_0(), semanticObject.getExactValue());
feeder.finish();
}
/**
* Contexts:
* Literal returns NegativeLiteral
* NegativeLiteral returns NegativeLiteral
*
* Constraint:
* atom=Atom
*/
protected void sequence_NegativeLiteral(ISerializationContext context, NegativeLiteral semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, ProblemPackage.Literals.NEGATIVE_LITERAL__ATOM) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ProblemPackage.Literals.NEGATIVE_LITERAL__ATOM));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getNegativeLiteralAccess().getAtomAtomParserRuleCall_1_0(), semanticObject.getAtom());
feeder.finish();
}
/**
* Contexts:
* Parameter returns Parameter
*
* Constraint:
* (parameterType=[ClassDeclaration|ID] name=ID)
*/
protected void sequence_Parameter(ISerializationContext context, org.eclipse.viatra.solver.language.model.problem.Parameter semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, ProblemPackage.Literals.PARAMETER__PARAMETER_TYPE) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ProblemPackage.Literals.PARAMETER__PARAMETER_TYPE));
if (transientValues.isValueTransient(semanticObject, ProblemPackage.Literals.NAMED_ELEMENT__NAME) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ProblemPackage.Literals.NAMED_ELEMENT__NAME));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getParameterAccess().getParameterTypeClassDeclarationIDTerminalRuleCall_0_0_1(), semanticObject.eGet(ProblemPackage.Literals.PARAMETER__PARAMETER_TYPE, false));
feeder.accept(grammarAccess.getParameterAccess().getNameIDTerminalRuleCall_1_0(), semanticObject.getName());
feeder.finish();
}
/**
* Contexts:
* Statement returns PredicateDefinition
* PredicateDefinition returns PredicateDefinition
*
* Constraint:
* (error?='error'? name=ID (parameters+=Parameter parameters+=Parameter*)? (bodies+=Conjunction bodies+=Conjunction*)?)
*/
protected void sequence_PredicateDefinition(ISerializationContext context, PredicateDefinition semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Contexts:
* Problem returns Problem
*
* Constraint:
* statements+=Statement+
*/
protected void sequence_Problem(ISerializationContext context, Problem semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Contexts:
* Multiplicity returns RangeMultiplicity
* RangeMultiplicity returns RangeMultiplicity
*
* Constraint:
* (lowerBound=INT upperBound=UpperBound)
*/
protected void sequence_RangeMultiplicity(ISerializationContext context, RangeMultiplicity semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, ProblemPackage.Literals.RANGE_MULTIPLICITY__LOWER_BOUND) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ProblemPackage.Literals.RANGE_MULTIPLICITY__LOWER_BOUND));
if (transientValues.isValueTransient(semanticObject, ProblemPackage.Literals.RANGE_MULTIPLICITY__UPPER_BOUND) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ProblemPackage.Literals.RANGE_MULTIPLICITY__UPPER_BOUND));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getRangeMultiplicityAccess().getLowerBoundINTTerminalRuleCall_0_0(), semanticObject.getLowerBound());
feeder.accept(grammarAccess.getRangeMultiplicityAccess().getUpperBoundUpperBoundParserRuleCall_2_0(), semanticObject.getUpperBound());
feeder.finish();
}
/**
* Contexts:
* ReferenceDeclaration returns ReferenceDeclaration
*
* Constraint:
* (containment?='contains'? referenceType=[ClassDeclaration|ID] multiplicity=Multiplicity name=ID opposite=[ReferenceDeclaration|QualifiedName]?)
*/
protected void sequence_ReferenceDeclaration(ISerializationContext context, ReferenceDeclaration semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Contexts:
* Statement returns ScopeDeclaration
* ScopeDeclaration returns ScopeDeclaration
*
* Constraint:
* (typeScopes+=TypeScope typeScopes+=TypeScope*)
*/
protected void sequence_ScopeDeclaration(ISerializationContext context, ScopeDeclaration semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Contexts:
* TypeScope returns TypeScope
*
* Constraint:
* (targetType=[ClassDeclaration|ID] increment?='+='? multiplicity=Multiplicity)
*/
protected void sequence_TypeScope(ISerializationContext context, TypeScope semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
}
|