/*
 * generated by Xtext 2.18.0.M3
 */
package co.edu.uniandes.accordant_rq.serializer;

import co.edu.uniandes.accordant_rq.Accordant_rqPackage;
import co.edu.uniandes.accordant_rq.AnalyzedQS;
import co.edu.uniandes.accordant_rq.ArchDecision;
import co.edu.uniandes.accordant_rq.Constraint;
import co.edu.uniandes.accordant_rq.Project;
import co.edu.uniandes.accordant_rq.QScenario;
import co.edu.uniandes.accordant_rq.Tactic;
import co.edu.uniandes.accordant_rq.services.AinlGrammarAccess;
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;

@SuppressWarnings("all")
public abstract class AbstractAinlSemanticSequencer extends AbstractDelegatingSemanticSequencer {

	@Inject
	private AinlGrammarAccess 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 == Accordant_rqPackage.eINSTANCE)
			switch (semanticObject.eClass().getClassifierID()) {
			case Accordant_rqPackage.ANALYZED_QS:
				sequence_AnalyzedQS(context, (AnalyzedQS) semanticObject); 
				return; 
			case Accordant_rqPackage.ARCH_DECISION:
				sequence_ArchDecision(context, (ArchDecision) semanticObject); 
				return; 
			case Accordant_rqPackage.CONSTRAINT:
				sequence_Constraint(context, (Constraint) semanticObject); 
				return; 
			case Accordant_rqPackage.PROJECT:
				sequence_Project(context, (Project) semanticObject); 
				return; 
			case Accordant_rqPackage.QSCENARIO:
				sequence_QScenario(context, (QScenario) semanticObject); 
				return; 
			case Accordant_rqPackage.TACTIC:
				sequence_Tactic(context, (Tactic) semanticObject); 
				return; 
			}
		if (errorAcceptor != null)
			errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
	}
	
	/**
	 * Contexts:
	 *     AnalyzedQS returns AnalyzedQS
	 *
	 * Constraint:
	 *     (name=ID qs=[QScenario|ID] reasoning=EString? decisions=ArchDecision?)
	 */
	protected void sequence_AnalyzedQS(ISerializationContext context, AnalyzedQS semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Contexts:
	 *     ArchDecision returns ArchDecision
	 *
	 * Constraint:
	 *     (
	 *         name=ID 
	 *         isRisk?='isRisk'? 
	 *         isSensitivityPoint?='isSensitivityPoint'? 
	 *         rationale=EString? 
	 *         code=EString? 
	 *         appliedTactics+=[Tactic|ID] 
	 *         appliedTactics+=[Tactic|ID]*
	 *     )
	 */
	protected void sequence_ArchDecision(ISerializationContext context, ArchDecision semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Contexts:
	 *     Constraint returns Constraint
	 *
	 * Constraint:
	 *     (code=ID (type=ConstraintType value=EString)?)
	 */
	protected void sequence_Constraint(ISerializationContext context, Constraint semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Contexts:
	 *     Project returns Project
	 *
	 * Constraint:
	 *     (
	 *         name=ID 
	 *         scenarios+=QScenario 
	 *         scenarios+=QScenario* 
	 *         (analyzedQs+=AnalyzedQS analyzedQs+=AnalyzedQS*)? 
	 *         (constraints+=Constraint constraints+=Constraint*)? 
	 *         tactics+=Tactic 
	 *         tactics+=Tactic*
	 *     )
	 */
	protected void sequence_Project(ISerializationContext context, Project semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Contexts:
	 *     QScenario returns QScenario
	 *
	 * Constraint:
	 *     (
	 *         name=ID 
	 *         qAttribute=QAttribute 
	 *         stimulus=EString 
	 *         environment=EString 
	 *         response=EString 
	 *         measure=QAMetric 
	 *         minValue=EFloat 
	 *         maxValue=EFloat 
	 *         unit=MetricUnit
	 *     )
	 */
	protected void sequence_QScenario(ISerializationContext context, QScenario semanticObject) {
		if (errorAcceptor != null) {
			if (transientValues.isValueTransient(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__NAME) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__NAME));
			if (transientValues.isValueTransient(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__QATTRIBUTE) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__QATTRIBUTE));
			if (transientValues.isValueTransient(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__STIMULUS) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__STIMULUS));
			if (transientValues.isValueTransient(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__ENVIRONMENT) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__ENVIRONMENT));
			if (transientValues.isValueTransient(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__RESPONSE) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__RESPONSE));
			if (transientValues.isValueTransient(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__MEASURE) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__MEASURE));
			if (transientValues.isValueTransient(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__MIN_VALUE) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__MIN_VALUE));
			if (transientValues.isValueTransient(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__MAX_VALUE) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__MAX_VALUE));
			if (transientValues.isValueTransient(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__UNIT) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Accordant_rqPackage.Literals.QSCENARIO__UNIT));
		}
		SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
		feeder.accept(grammarAccess.getQScenarioAccess().getNameIDTerminalRuleCall_1_0(), semanticObject.getName());
		feeder.accept(grammarAccess.getQScenarioAccess().getQAttributeQAttributeEnumRuleCall_5_0(), semanticObject.getQAttribute());
		feeder.accept(grammarAccess.getQScenarioAccess().getStimulusEStringParserRuleCall_8_0(), semanticObject.getStimulus());
		feeder.accept(grammarAccess.getQScenarioAccess().getEnvironmentEStringParserRuleCall_11_0(), semanticObject.getEnvironment());
		feeder.accept(grammarAccess.getQScenarioAccess().getResponseEStringParserRuleCall_14_0(), semanticObject.getResponse());
		feeder.accept(grammarAccess.getQScenarioAccess().getMeasureQAMetricEnumRuleCall_17_0(), semanticObject.getMeasure());
		feeder.accept(grammarAccess.getQScenarioAccess().getMinValueEFloatParserRuleCall_19_0(), semanticObject.getMinValue());
		feeder.accept(grammarAccess.getQScenarioAccess().getMaxValueEFloatParserRuleCall_21_0(), semanticObject.getMaxValue());
		feeder.accept(grammarAccess.getQScenarioAccess().getUnitMetricUnitEnumRuleCall_23_0(), semanticObject.getUnit());
		feeder.finish();
	}
	
	
	/**
	 * Contexts:
	 *     Tactic returns Tactic
	 *
	 * Constraint:
	 *     (
	 *         name=ID 
	 *         qAttribute=QAttribute? 
	 *         rationale=EString? 
	 *         stimulus=EString? 
	 *         response=EString? 
	 *         viewpoint=EString?
	 *     )
	 */
	protected void sequence_Tactic(ISerializationContext context, Tactic semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
}
