139 lines
5.4 KiB
Java
139 lines
5.4 KiB
Java
|
/*
|
||
|
* generated by Xtext 2.23.0
|
||
|
*/
|
||
|
package fr.n7.serializer;
|
||
|
|
||
|
import com.google.inject.Inject;
|
||
|
import fr.n7.pDL1.PDL1Package;
|
||
|
import fr.n7.pDL1.WorkDefinition;
|
||
|
import fr.n7.pDL1.WorkDefinitionList;
|
||
|
import fr.n7.pDL1.WorkSequence;
|
||
|
import fr.n7.pDL1.WorkSequenceList;
|
||
|
import fr.n7.services.PDL1GrammarAccess;
|
||
|
import java.util.Set;
|
||
|
import org.eclipse.emf.ecore.EObject;
|
||
|
import org.eclipse.emf.ecore.EPackage;
|
||
|
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 PDL1SemanticSequencer extends AbstractDelegatingSemanticSequencer {
|
||
|
|
||
|
@Inject
|
||
|
private PDL1GrammarAccess 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 == PDL1Package.eINSTANCE)
|
||
|
switch (semanticObject.eClass().getClassifierID()) {
|
||
|
case PDL1Package.PROCESS:
|
||
|
sequence_Process(context, (fr.n7.pDL1.Process) semanticObject);
|
||
|
return;
|
||
|
case PDL1Package.WORK_DEFINITION:
|
||
|
sequence_WorkDefinition(context, (WorkDefinition) semanticObject);
|
||
|
return;
|
||
|
case PDL1Package.WORK_DEFINITION_LIST:
|
||
|
sequence_WorkDefinitionList(context, (WorkDefinitionList) semanticObject);
|
||
|
return;
|
||
|
case PDL1Package.WORK_SEQUENCE:
|
||
|
sequence_WorkSequence(context, (WorkSequence) semanticObject);
|
||
|
return;
|
||
|
case PDL1Package.WORK_SEQUENCE_LIST:
|
||
|
sequence_WorkSequenceList(context, (WorkSequenceList) semanticObject);
|
||
|
return;
|
||
|
}
|
||
|
if (errorAcceptor != null)
|
||
|
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Contexts:
|
||
|
* Process returns Process
|
||
|
*
|
||
|
* Constraint:
|
||
|
* (name=ID processElements+=ProcessElement*)
|
||
|
*/
|
||
|
protected void sequence_Process(ISerializationContext context, fr.n7.pDL1.Process semanticObject) {
|
||
|
genericSequencer.createSequence(context, semanticObject);
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Contexts:
|
||
|
* ProcessElement returns WorkDefinitionList
|
||
|
* WorkDefinitionList returns WorkDefinitionList
|
||
|
*
|
||
|
* Constraint:
|
||
|
* WorkDefinition+=WorkDefinition+
|
||
|
*/
|
||
|
protected void sequence_WorkDefinitionList(ISerializationContext context, WorkDefinitionList semanticObject) {
|
||
|
genericSequencer.createSequence(context, semanticObject);
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Contexts:
|
||
|
* WorkDefinition returns WorkDefinition
|
||
|
*
|
||
|
* Constraint:
|
||
|
* name=ID
|
||
|
*/
|
||
|
protected void sequence_WorkDefinition(ISerializationContext context, WorkDefinition semanticObject) {
|
||
|
if (errorAcceptor != null) {
|
||
|
if (transientValues.isValueTransient(semanticObject, PDL1Package.Literals.WORK_DEFINITION__NAME) == ValueTransient.YES)
|
||
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, PDL1Package.Literals.WORK_DEFINITION__NAME));
|
||
|
}
|
||
|
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
|
||
|
feeder.accept(grammarAccess.getWorkDefinitionAccess().getNameIDTerminalRuleCall_0_0(), semanticObject.getName());
|
||
|
feeder.finish();
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Contexts:
|
||
|
* ProcessElement returns WorkSequenceList
|
||
|
* WorkSequenceList returns WorkSequenceList
|
||
|
*
|
||
|
* Constraint:
|
||
|
* WorkSequence+=WorkSequence+
|
||
|
*/
|
||
|
protected void sequence_WorkSequenceList(ISerializationContext context, WorkSequenceList semanticObject) {
|
||
|
genericSequencer.createSequence(context, semanticObject);
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Contexts:
|
||
|
* WorkSequence returns WorkSequence
|
||
|
*
|
||
|
* Constraint:
|
||
|
* (predecessor=[WorkDefinition|ID] linkType=WorkSequenceType successor=[WorkDefinition|ID])
|
||
|
*/
|
||
|
protected void sequence_WorkSequence(ISerializationContext context, WorkSequence semanticObject) {
|
||
|
if (errorAcceptor != null) {
|
||
|
if (transientValues.isValueTransient(semanticObject, PDL1Package.Literals.WORK_SEQUENCE__PREDECESSOR) == ValueTransient.YES)
|
||
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, PDL1Package.Literals.WORK_SEQUENCE__PREDECESSOR));
|
||
|
if (transientValues.isValueTransient(semanticObject, PDL1Package.Literals.WORK_SEQUENCE__LINK_TYPE) == ValueTransient.YES)
|
||
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, PDL1Package.Literals.WORK_SEQUENCE__LINK_TYPE));
|
||
|
if (transientValues.isValueTransient(semanticObject, PDL1Package.Literals.WORK_SEQUENCE__SUCCESSOR) == ValueTransient.YES)
|
||
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, PDL1Package.Literals.WORK_SEQUENCE__SUCCESSOR));
|
||
|
}
|
||
|
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
|
||
|
feeder.accept(grammarAccess.getWorkSequenceAccess().getPredecessorWorkDefinitionIDTerminalRuleCall_0_0_1(), semanticObject.eGet(PDL1Package.Literals.WORK_SEQUENCE__PREDECESSOR, false));
|
||
|
feeder.accept(grammarAccess.getWorkSequenceAccess().getLinkTypeWorkSequenceTypeEnumRuleCall_1_0(), semanticObject.getLinkType());
|
||
|
feeder.accept(grammarAccess.getWorkSequenceAccess().getSuccessorWorkDefinitionIDTerminalRuleCall_2_0_1(), semanticObject.eGet(PDL1Package.Literals.WORK_SEQUENCE__SUCCESSOR, false));
|
||
|
feeder.finish();
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|