SmachDSLSemanticSequencer.java
Go to the documentation of this file.
00001 package org.best.of.robotics.serializer;
00002 
00003 import com.google.inject.Inject;
00004 import com.google.inject.Provider;
00005 import org.best.of.robotics.services.SmachDSLGrammarAccess;
00006 import org.best.of.robotics.smachDSL.ActionClient;
00007 import org.best.of.robotics.smachDSL.ActionState;
00008 import org.best.of.robotics.smachDSL.PrimitivePackage;
00009 import org.best.of.robotics.smachDSL.ServiceClient;
00010 import org.best.of.robotics.smachDSL.SmachDSLPackage;
00011 import org.best.of.robotics.smachDSL.StateMachine;
00012 import org.best.of.robotics.smachDSL.Test;
00013 import org.best.of.robotics.smachDSL.Transition;
00014 import org.eclipse.emf.ecore.EObject;
00015 import org.eclipse.xtext.serializer.acceptor.ISemanticSequenceAcceptor;
00016 import org.eclipse.xtext.serializer.acceptor.SequenceFeeder;
00017 import org.eclipse.xtext.serializer.diagnostic.ISemanticSequencerDiagnosticProvider;
00018 import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor;
00019 import org.eclipse.xtext.serializer.sequencer.AbstractDelegatingSemanticSequencer;
00020 import org.eclipse.xtext.serializer.sequencer.GenericSequencer;
00021 import org.eclipse.xtext.serializer.sequencer.ISemanticNodeProvider.INodesForEObjectProvider;
00022 import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer;
00023 import org.eclipse.xtext.serializer.sequencer.ITransientValueService;
00024 import org.eclipse.xtext.serializer.sequencer.ITransientValueService.ValueTransient;
00025 
00026 @SuppressWarnings("all")
00027 public class SmachDSLSemanticSequencer extends AbstractDelegatingSemanticSequencer {
00028 
00029         @Inject
00030         private SmachDSLGrammarAccess grammarAccess;
00031         
00032         public void createSequence(EObject context, EObject semanticObject) {
00033                 if(semanticObject.eClass().getEPackage() == SmachDSLPackage.eINSTANCE) switch(semanticObject.eClass().getClassifierID()) {
00034                         case SmachDSLPackage.ACTION_CLIENT:
00035                                 if(context == grammarAccess.getActionClientRule()) {
00036                                         sequence_ActionClient(context, (ActionClient) semanticObject); 
00037                                         return; 
00038                                 }
00039                                 else break;
00040                         case SmachDSLPackage.ACTION_STATE:
00041                                 if(context == grammarAccess.getActionStateRule()) {
00042                                         sequence_ActionState(context, (ActionState) semanticObject); 
00043                                         return; 
00044                                 }
00045                                 else break;
00046                         case SmachDSLPackage.PRIMITIVE_PACKAGE:
00047                                 if(context == grammarAccess.getPrimitivePackageRule()) {
00048                                         sequence_PrimitivePackage(context, (PrimitivePackage) semanticObject); 
00049                                         return; 
00050                                 }
00051                                 else break;
00052                         case SmachDSLPackage.SERVICE_CLIENT:
00053                                 if(context == grammarAccess.getServiceClientRule()) {
00054                                         sequence_ServiceClient(context, (ServiceClient) semanticObject); 
00055                                         return; 
00056                                 }
00057                                 else break;
00058                         case SmachDSLPackage.STATE_MACHINE:
00059                                 if(context == grammarAccess.getStateMachineRule()) {
00060                                         sequence_StateMachine(context, (StateMachine) semanticObject); 
00061                                         return; 
00062                                 }
00063                                 else break;
00064                         case SmachDSLPackage.TEST:
00065                                 if(context == grammarAccess.getTestRule()) {
00066                                         sequence_Test(context, (Test) semanticObject); 
00067                                         return; 
00068                                 }
00069                                 else break;
00070                         case SmachDSLPackage.TRANSITION:
00071                                 if(context == grammarAccess.getTransitionRule()) {
00072                                         sequence_Transition(context, (Transition) semanticObject); 
00073                                         return; 
00074                                 }
00075                                 else break;
00076                         }
00077                 if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
00078         }
00079         
00084         protected void sequence_ActionClient(EObject context, ActionClient semanticObject) {
00085                 if(errorAcceptor != null) {
00086                         if(transientValues.isValueTransient(semanticObject, SmachDSLPackage.Literals.ACTION_CLIENT__NAME) == ValueTransient.YES)
00087                                 errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SmachDSLPackage.Literals.ACTION_CLIENT__NAME));
00088                         if(transientValues.isValueTransient(semanticObject, SmachDSLPackage.Literals.ACTION_CLIENT__ACTIONNAME) == ValueTransient.YES)
00089                                 errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SmachDSLPackage.Literals.ACTION_CLIENT__ACTIONNAME));
00090                         if(transientValues.isValueTransient(semanticObject, SmachDSLPackage.Literals.ACTION_CLIENT__ACTIONTYPE) == ValueTransient.YES)
00091                                 errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SmachDSLPackage.Literals.ACTION_CLIENT__ACTIONTYPE));
00092                 }
00093                 INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
00094                 SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
00095                 feeder.accept(grammarAccess.getActionClientAccess().getNameIDTerminalRuleCall_1_0(), semanticObject.getName());
00096                 feeder.accept(grammarAccess.getActionClientAccess().getActionnameSTRINGTerminalRuleCall_4_0(), semanticObject.getActionname());
00097                 feeder.accept(grammarAccess.getActionClientAccess().getActiontypeSTRINGTerminalRuleCall_7_0(), semanticObject.getActiontype());
00098                 feeder.finish();
00099         }
00100         
00101         
00106         protected void sequence_ActionState(EObject context, ActionState semanticObject) {
00107                 genericSequencer.createSequence(context, semanticObject);
00108         }
00109         
00110         
00115         protected void sequence_PrimitivePackage(EObject context, PrimitivePackage semanticObject) {
00116                 genericSequencer.createSequence(context, semanticObject);
00117         }
00118         
00119         
00124         protected void sequence_ServiceClient(EObject context, ServiceClient semanticObject) {
00125                 if(errorAcceptor != null) {
00126                         if(transientValues.isValueTransient(semanticObject, SmachDSLPackage.Literals.SERVICE_CLIENT__NAME) == ValueTransient.YES)
00127                                 errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SmachDSLPackage.Literals.SERVICE_CLIENT__NAME));
00128                         if(transientValues.isValueTransient(semanticObject, SmachDSLPackage.Literals.SERVICE_CLIENT__SERVICENAME) == ValueTransient.YES)
00129                                 errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SmachDSLPackage.Literals.SERVICE_CLIENT__SERVICENAME));
00130                         if(transientValues.isValueTransient(semanticObject, SmachDSLPackage.Literals.SERVICE_CLIENT__SERVICESRV) == ValueTransient.YES)
00131                                 errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SmachDSLPackage.Literals.SERVICE_CLIENT__SERVICESRV));
00132                 }
00133                 INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
00134                 SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
00135                 feeder.accept(grammarAccess.getServiceClientAccess().getNameIDTerminalRuleCall_1_0(), semanticObject.getName());
00136                 feeder.accept(grammarAccess.getServiceClientAccess().getServicenameSTRINGTerminalRuleCall_4_0(), semanticObject.getServicename());
00137                 feeder.accept(grammarAccess.getServiceClientAccess().getServicesrvSTRINGTerminalRuleCall_7_0(), semanticObject.getServicesrv());
00138                 feeder.finish();
00139         }
00140         
00141         
00146         protected void sequence_StateMachine(EObject context, StateMachine semanticObject) {
00147                 genericSequencer.createSequence(context, semanticObject);
00148         }
00149         
00150         
00155         protected void sequence_Test(EObject context, Test semanticObject) {
00156                 if(errorAcceptor != null) {
00157                         if(transientValues.isValueTransient(semanticObject, SmachDSLPackage.Literals.TEST__ROS) == ValueTransient.YES)
00158                                 errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SmachDSLPackage.Literals.TEST__ROS));
00159                 }
00160                 INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
00161                 SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
00162                 feeder.accept(grammarAccess.getTestAccess().getRosSTRINGTerminalRuleCall_0(), semanticObject.getRos());
00163                 feeder.finish();
00164         }
00165         
00166         
00171         protected void sequence_Transition(EObject context, Transition semanticObject) {
00172                 if(errorAcceptor != null) {
00173                         if(transientValues.isValueTransient(semanticObject, SmachDSLPackage.Literals.TRANSITION__OUTCOME) == ValueTransient.YES)
00174                                 errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SmachDSLPackage.Literals.TRANSITION__OUTCOME));
00175                         if(transientValues.isValueTransient(semanticObject, SmachDSLPackage.Literals.TRANSITION__STATE) == ValueTransient.YES)
00176                                 errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SmachDSLPackage.Literals.TRANSITION__STATE));
00177                 }
00178                 INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
00179                 SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
00180                 feeder.accept(grammarAccess.getTransitionAccess().getOutcomeOUTCOMEParserRuleCall_0_0(), semanticObject.getOutcome());
00181                 feeder.accept(grammarAccess.getTransitionAccess().getStateActionStateIDTerminalRuleCall_2_0_1(), semanticObject.getState());
00182                 feeder.finish();
00183         }
00184 }


bride_plugin_source
Author(s): Alexander Bubeck
autogenerated on Sun Oct 5 2014 22:38:34