373 lines
13 KiB
Java
373 lines
13 KiB
Java
/*
|
|
* generated by Xtext 2.23.0
|
|
*/
|
|
package xtext.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.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;
|
|
import xtext.game.AntiConditionConnaissance;
|
|
import xtext.game.Chemin;
|
|
import xtext.game.Condition;
|
|
import xtext.game.ConditionConnaissance;
|
|
import xtext.game.ConditionEt;
|
|
import xtext.game.ConditionObjet;
|
|
import xtext.game.Connaissance;
|
|
import xtext.game.Description;
|
|
import xtext.game.Explorateur;
|
|
import xtext.game.GamePackage;
|
|
import xtext.game.Interraction;
|
|
import xtext.game.Jeu;
|
|
import xtext.game.Lieu;
|
|
import xtext.game.Objet;
|
|
import xtext.game.Personne;
|
|
import xtext.game.Territoire;
|
|
import xtext.game.Transformation;
|
|
import xtext.services.GameGrammarAccess;
|
|
|
|
@SuppressWarnings("all")
|
|
public class GameSemanticSequencer extends AbstractDelegatingSemanticSequencer {
|
|
|
|
@Inject
|
|
private GameGrammarAccess 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 == GamePackage.eINSTANCE)
|
|
switch (semanticObject.eClass().getClassifierID()) {
|
|
case GamePackage.ACTION:
|
|
sequence_Action(context, (xtext.game.Action) semanticObject);
|
|
return;
|
|
case GamePackage.ANTI_CONDITION_CONNAISSANCE:
|
|
sequence_AntiConditionConnaissance(context, (AntiConditionConnaissance) semanticObject);
|
|
return;
|
|
case GamePackage.CHEMIN:
|
|
sequence_Chemin(context, (Chemin) semanticObject);
|
|
return;
|
|
case GamePackage.CONDITION:
|
|
sequence_Condition(context, (Condition) semanticObject);
|
|
return;
|
|
case GamePackage.CONDITION_CONNAISSANCE:
|
|
sequence_ConditionConnaissance(context, (ConditionConnaissance) semanticObject);
|
|
return;
|
|
case GamePackage.CONDITION_ET:
|
|
sequence_ConditionEt(context, (ConditionEt) semanticObject);
|
|
return;
|
|
case GamePackage.CONDITION_OBJET:
|
|
sequence_ConditionObjet(context, (ConditionObjet) semanticObject);
|
|
return;
|
|
case GamePackage.CONNAISSANCE:
|
|
sequence_Connaissance(context, (Connaissance) semanticObject);
|
|
return;
|
|
case GamePackage.DESCRIPTION:
|
|
sequence_Description(context, (Description) semanticObject);
|
|
return;
|
|
case GamePackage.EXPLORATEUR:
|
|
sequence_Explorateur(context, (Explorateur) semanticObject);
|
|
return;
|
|
case GamePackage.INTERRACTION:
|
|
sequence_Interraction(context, (Interraction) semanticObject);
|
|
return;
|
|
case GamePackage.JEU:
|
|
sequence_Jeu(context, (Jeu) semanticObject);
|
|
return;
|
|
case GamePackage.LIEU:
|
|
sequence_Lieu(context, (Lieu) semanticObject);
|
|
return;
|
|
case GamePackage.OBJET:
|
|
sequence_Objet(context, (Objet) semanticObject);
|
|
return;
|
|
case GamePackage.PERSONNE:
|
|
sequence_Personne(context, (Personne) semanticObject);
|
|
return;
|
|
case GamePackage.TERRITOIRE:
|
|
sequence_Territoire(context, (Territoire) semanticObject);
|
|
return;
|
|
case GamePackage.TRANSFORMATION:
|
|
sequence_Transformation(context, (Transformation) semanticObject);
|
|
return;
|
|
}
|
|
if (errorAcceptor != null)
|
|
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
|
|
}
|
|
|
|
/**
|
|
* Contexts:
|
|
* Action returns Action
|
|
*
|
|
* Constraint:
|
|
* (connaissances+=Nom* objets+=Nom* objetsConso+=Nom* visible=Condition finInterraction=Condition)
|
|
*/
|
|
protected void sequence_Action(ISerializationContext context, xtext.game.Action semanticObject) {
|
|
genericSequencer.createSequence(context, semanticObject);
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* ConditionTest returns AntiConditionConnaissance
|
|
* AntiConditionConnaissance returns AntiConditionConnaissance
|
|
*
|
|
* Constraint:
|
|
* connaissance=Nom
|
|
*/
|
|
protected void sequence_AntiConditionConnaissance(ISerializationContext context, AntiConditionConnaissance semanticObject) {
|
|
if (errorAcceptor != null) {
|
|
if (transientValues.isValueTransient(semanticObject, GamePackage.Literals.ANTI_CONDITION_CONNAISSANCE__CONNAISSANCE) == ValueTransient.YES)
|
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, GamePackage.Literals.ANTI_CONDITION_CONNAISSANCE__CONNAISSANCE));
|
|
}
|
|
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
|
|
feeder.accept(grammarAccess.getAntiConditionConnaissanceAccess().getConnaissanceNomParserRuleCall_1_0(), semanticObject.getConnaissance());
|
|
feeder.finish();
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* Chemin returns Chemin
|
|
*
|
|
* Constraint:
|
|
* (
|
|
* lieuIn=Nom
|
|
* lieuOut=Nom
|
|
* connaissances+=Nom*
|
|
* objets+=Nom*
|
|
* objetsConso+=Nom*
|
|
* ouvert=Condition
|
|
* ferme=Condition
|
|
* obligatoire=Condition
|
|
* descriptions+=Description+
|
|
* )
|
|
*/
|
|
protected void sequence_Chemin(ISerializationContext context, Chemin semanticObject) {
|
|
genericSequencer.createSequence(context, semanticObject);
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* ConditionTest returns ConditionConnaissance
|
|
* ConditionConnaissance returns ConditionConnaissance
|
|
*
|
|
* Constraint:
|
|
* connaissance=Nom
|
|
*/
|
|
protected void sequence_ConditionConnaissance(ISerializationContext context, ConditionConnaissance semanticObject) {
|
|
if (errorAcceptor != null) {
|
|
if (transientValues.isValueTransient(semanticObject, GamePackage.Literals.CONDITION_CONNAISSANCE__CONNAISSANCE) == ValueTransient.YES)
|
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, GamePackage.Literals.CONDITION_CONNAISSANCE__CONNAISSANCE));
|
|
}
|
|
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
|
|
feeder.accept(grammarAccess.getConditionConnaissanceAccess().getConnaissanceNomParserRuleCall_0(), semanticObject.getConnaissance());
|
|
feeder.finish();
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* ConditionEt returns ConditionEt
|
|
*
|
|
* Constraint:
|
|
* (conditionTest+=[ConditionTest|ID] conditonTest+=[ConditionTest|ID]*)
|
|
*/
|
|
protected void sequence_ConditionEt(ISerializationContext context, ConditionEt semanticObject) {
|
|
genericSequencer.createSequence(context, semanticObject);
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* ConditionTest returns ConditionObjet
|
|
* ConditionObjet returns ConditionObjet
|
|
*
|
|
* Constraint:
|
|
* (objet=STRING comparateur=Comparateur nombre=INT)
|
|
*/
|
|
protected void sequence_ConditionObjet(ISerializationContext context, ConditionObjet semanticObject) {
|
|
if (errorAcceptor != null) {
|
|
if (transientValues.isValueTransient(semanticObject, GamePackage.Literals.CONDITION_OBJET__OBJET) == ValueTransient.YES)
|
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, GamePackage.Literals.CONDITION_OBJET__OBJET));
|
|
if (transientValues.isValueTransient(semanticObject, GamePackage.Literals.CONDITION_OBJET__COMPARATEUR) == ValueTransient.YES)
|
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, GamePackage.Literals.CONDITION_OBJET__COMPARATEUR));
|
|
if (transientValues.isValueTransient(semanticObject, GamePackage.Literals.CONDITION_OBJET__NOMBRE) == ValueTransient.YES)
|
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, GamePackage.Literals.CONDITION_OBJET__NOMBRE));
|
|
}
|
|
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
|
|
feeder.accept(grammarAccess.getConditionObjetAccess().getObjetSTRINGTerminalRuleCall_0_0(), semanticObject.getObjet());
|
|
feeder.accept(grammarAccess.getConditionObjetAccess().getComparateurComparateurParserRuleCall_1_0(), semanticObject.getComparateur());
|
|
feeder.accept(grammarAccess.getConditionObjetAccess().getNombreINTTerminalRuleCall_2_0(), semanticObject.getNombre());
|
|
feeder.finish();
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* Condition returns Condition
|
|
*
|
|
* Constraint:
|
|
* (condition+=[ConditionEt|ID] condition+=[ConditionEt|ID]*)
|
|
*/
|
|
protected void sequence_Condition(ISerializationContext context, Condition semanticObject) {
|
|
genericSequencer.createSequence(context, semanticObject);
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* Connaissance returns Connaissance
|
|
*
|
|
* Constraint:
|
|
* (nom=Nom visible=Condition descriptions+=Description+)
|
|
*/
|
|
protected void sequence_Connaissance(ISerializationContext context, Connaissance semanticObject) {
|
|
genericSequencer.createSequence(context, semanticObject);
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* Description returns Description
|
|
*
|
|
* Constraint:
|
|
* (texte=STRING condition=Condition)
|
|
*/
|
|
protected void sequence_Description(ISerializationContext context, Description semanticObject) {
|
|
if (errorAcceptor != null) {
|
|
if (transientValues.isValueTransient(semanticObject, GamePackage.Literals.DESCRIPTION__TEXTE) == ValueTransient.YES)
|
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, GamePackage.Literals.DESCRIPTION__TEXTE));
|
|
if (transientValues.isValueTransient(semanticObject, GamePackage.Literals.DESCRIPTION__CONDITION) == ValueTransient.YES)
|
|
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, GamePackage.Literals.DESCRIPTION__CONDITION));
|
|
}
|
|
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
|
|
feeder.accept(grammarAccess.getDescriptionAccess().getTexteSTRINGTerminalRuleCall_2_0(), semanticObject.getTexte());
|
|
feeder.accept(grammarAccess.getDescriptionAccess().getConditionConditionParserRuleCall_3_0(), semanticObject.getCondition());
|
|
feeder.finish();
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* Explorateur returns Explorateur
|
|
*
|
|
* Constraint:
|
|
* (tailleTotaleMax=INT connaissances+=Nom* objets+=Nom*)
|
|
*/
|
|
protected void sequence_Explorateur(ISerializationContext context, Explorateur semanticObject) {
|
|
genericSequencer.createSequence(context, semanticObject);
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* Interraction returns Interraction
|
|
*
|
|
* Constraint:
|
|
* (actions+=Action+ connaissances+=Nom* objets+=Nom* visible=Condition)
|
|
*/
|
|
protected void sequence_Interraction(ISerializationContext context, Interraction semanticObject) {
|
|
genericSequencer.createSequence(context, semanticObject);
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* Jeu returns Jeu
|
|
*
|
|
* Constraint:
|
|
* (
|
|
* explorateur=Explorateur
|
|
* territoire=Territoire
|
|
* objets+=Objet*
|
|
* connaissances+=Connaissance*
|
|
* personnes+=Personne*
|
|
* transformations+=Transformation*
|
|
* )
|
|
*/
|
|
protected void sequence_Jeu(ISerializationContext context, Jeu semanticObject) {
|
|
genericSequencer.createSequence(context, semanticObject);
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* Lieu returns Lieu
|
|
*
|
|
* Constraint:
|
|
* (
|
|
* nom=Nom
|
|
* connaissances+=Nom*
|
|
* personnes+=Personne*
|
|
* objets+=Nom*
|
|
* deposable=Condition
|
|
* descriptions+=Description+
|
|
* depart=Condition
|
|
* fin=Condition
|
|
* )
|
|
*/
|
|
protected void sequence_Lieu(ISerializationContext context, Lieu semanticObject) {
|
|
genericSequencer.createSequence(context, semanticObject);
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* Objet returns Objet
|
|
*
|
|
* Constraint:
|
|
* (nom=Nom taille=INT visible=Condition descriptions+=Description+)
|
|
*/
|
|
protected void sequence_Objet(ISerializationContext context, Objet semanticObject) {
|
|
genericSequencer.createSequence(context, semanticObject);
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* Personne returns Personne
|
|
*
|
|
* Constraint:
|
|
* (visible=Condition obligatoire=Condition interractions+=Interraction+)
|
|
*/
|
|
protected void sequence_Personne(ISerializationContext context, Personne semanticObject) {
|
|
genericSequencer.createSequence(context, semanticObject);
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* Territoire returns Territoire
|
|
*
|
|
* Constraint:
|
|
* (lieux+=Lieu+ chemins+=Chemin*)
|
|
*/
|
|
protected void sequence_Territoire(ISerializationContext context, Territoire semanticObject) {
|
|
genericSequencer.createSequence(context, semanticObject);
|
|
}
|
|
|
|
|
|
/**
|
|
* Contexts:
|
|
* Transformation returns Transformation
|
|
*
|
|
* Constraint:
|
|
* (condition=Condition objetSource+=Nom+ objetsResultats+=Nom+)
|
|
*/
|
|
protected void sequence_Transformation(ISerializationContext context, Transformation semanticObject) {
|
|
genericSequencer.createSequence(context, semanticObject);
|
|
}
|
|
|
|
|
|
}
|