/*
 * generated by Xtext 2.12.0
 */
package com.irtsaintexupery.xtext.pseim.services;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.util.List;
import org.eclipse.xtext.Assignment;
import org.eclipse.xtext.CrossReference;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.GrammarUtil;
import org.eclipse.xtext.Group;
import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.ParserRule;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.TerminalRule;
import org.eclipse.xtext.common.services.TerminalsGrammarAccess;
import org.eclipse.xtext.service.AbstractElementFinder.AbstractGrammarElementFinder;
import org.eclipse.xtext.service.GrammarProvider;

@Singleton
public class MappingGrammarAccess extends AbstractGrammarElementFinder {
	
	public class PatternApplicationElements extends AbstractParserRuleElementFinder {
		private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "com.irtsaintexupery.xtext.pseim.Mapping.PatternApplication");
		private final Group cGroup = (Group)rule.eContents().get(1);
		private final Keyword cTransformKeyword_0 = (Keyword)cGroup.eContents().get(0);
		private final Assignment cModelAssignment_1 = (Assignment)cGroup.eContents().get(1);
		private final CrossReference cModelModelCrossReference_1_0 = (CrossReference)cModelAssignment_1.eContents().get(0);
		private final RuleCall cModelModelIDTerminalRuleCall_1_0_1 = (RuleCall)cModelModelCrossReference_1_0.eContents().get(1);
		private final Keyword cUsingKeyword_2 = (Keyword)cGroup.eContents().get(2);
		private final Assignment cPatternAssignment_3 = (Assignment)cGroup.eContents().get(3);
		private final CrossReference cPatternPatternCrossReference_3_0 = (CrossReference)cPatternAssignment_3.eContents().get(0);
		private final RuleCall cPatternPatternIDTerminalRuleCall_3_0_1 = (RuleCall)cPatternPatternCrossReference_3_0.eContents().get(1);
		private final Keyword cLeftCurlyBracketKeyword_4 = (Keyword)cGroup.eContents().get(4);
		private final Group cGroup_5 = (Group)cGroup.eContents().get(5);
		private final Keyword cMultiplicityKeyword_5_0 = (Keyword)cGroup_5.eContents().get(0);
		private final Assignment cCardinalityValuesAssignment_5_1 = (Assignment)cGroup_5.eContents().get(1);
		private final RuleCall cCardinalityValuesCardinalityValueParserRuleCall_5_1_0 = (RuleCall)cCardinalityValuesAssignment_5_1.eContents().get(0);
		private final Assignment cCardinalityValuesAssignment_5_2 = (Assignment)cGroup_5.eContents().get(2);
		private final RuleCall cCardinalityValuesCardinalityValueParserRuleCall_5_2_0 = (RuleCall)cCardinalityValuesAssignment_5_2.eContents().get(0);
		private final Group cGroup_6 = (Group)cGroup.eContents().get(6);
		private final Keyword cComponentsKeyword_6_0 = (Keyword)cGroup_6.eContents().get(0);
		private final Assignment cModelElementAssignment_6_1 = (Assignment)cGroup_6.eContents().get(1);
		private final RuleCall cModelElementGraphElementMappingParserRuleCall_6_1_0 = (RuleCall)cModelElementAssignment_6_1.eContents().get(0);
		private final Assignment cModelElementAssignment_6_2 = (Assignment)cGroup_6.eContents().get(2);
		private final RuleCall cModelElementGraphElementMappingParserRuleCall_6_2_0 = (RuleCall)cModelElementAssignment_6_2.eContents().get(0);
		private final Group cGroup_7 = (Group)cGroup.eContents().get(7);
		private final Keyword cPortsKeyword_7_0 = (Keyword)cGroup_7.eContents().get(0);
		private final Assignment cPortMappingAssignment_7_1 = (Assignment)cGroup_7.eContents().get(1);
		private final RuleCall cPortMappingPortMappingParserRuleCall_7_1_0 = (RuleCall)cPortMappingAssignment_7_1.eContents().get(0);
		private final Assignment cPortMappingAssignment_7_2 = (Assignment)cGroup_7.eContents().get(2);
		private final RuleCall cPortMappingPortMappingParserRuleCall_7_2_0 = (RuleCall)cPortMappingAssignment_7_2.eContents().get(0);
		private final Keyword cRightCurlyBracketKeyword_8 = (Keyword)cGroup.eContents().get(8);
		
		//PatternApplication mapping::PatternApplication:
		//	'transform' model=[seim::Model] 'using' pattern=[pseim::Pattern] '{' ('multiplicity'
		//	cardinalityValues+=CardinalityValue cardinalityValues+=CardinalityValue*)? ('components'
		//	modelElement+=GraphElementMapping modelElement+=GraphElementMapping*)? ('ports' portMapping+=PortMapping
		//	portMapping+=PortMapping*)?
		//	'}';
		@Override public ParserRule getRule() { return rule; }
		
		//'transform' model=[seim::Model] 'using' pattern=[pseim::Pattern] '{' ('multiplicity' cardinalityValues+=CardinalityValue
		//cardinalityValues+=CardinalityValue*)? ('components' modelElement+=GraphElementMapping
		//modelElement+=GraphElementMapping*)? ('ports' portMapping+=PortMapping portMapping+=PortMapping*)? '}'
		public Group getGroup() { return cGroup; }
		
		//'transform'
		public Keyword getTransformKeyword_0() { return cTransformKeyword_0; }
		
		//model=[seim::Model]
		public Assignment getModelAssignment_1() { return cModelAssignment_1; }
		
		//[seim::Model]
		public CrossReference getModelModelCrossReference_1_0() { return cModelModelCrossReference_1_0; }
		
		//ID
		public RuleCall getModelModelIDTerminalRuleCall_1_0_1() { return cModelModelIDTerminalRuleCall_1_0_1; }
		
		//'using'
		public Keyword getUsingKeyword_2() { return cUsingKeyword_2; }
		
		//pattern=[pseim::Pattern]
		public Assignment getPatternAssignment_3() { return cPatternAssignment_3; }
		
		//[pseim::Pattern]
		public CrossReference getPatternPatternCrossReference_3_0() { return cPatternPatternCrossReference_3_0; }
		
		//ID
		public RuleCall getPatternPatternIDTerminalRuleCall_3_0_1() { return cPatternPatternIDTerminalRuleCall_3_0_1; }
		
		//'{'
		public Keyword getLeftCurlyBracketKeyword_4() { return cLeftCurlyBracketKeyword_4; }
		
		//('multiplicity' cardinalityValues+=CardinalityValue cardinalityValues+=CardinalityValue*)?
		public Group getGroup_5() { return cGroup_5; }
		
		//'multiplicity'
		public Keyword getMultiplicityKeyword_5_0() { return cMultiplicityKeyword_5_0; }
		
		//cardinalityValues+=CardinalityValue
		public Assignment getCardinalityValuesAssignment_5_1() { return cCardinalityValuesAssignment_5_1; }
		
		//CardinalityValue
		public RuleCall getCardinalityValuesCardinalityValueParserRuleCall_5_1_0() { return cCardinalityValuesCardinalityValueParserRuleCall_5_1_0; }
		
		//cardinalityValues+=CardinalityValue*
		public Assignment getCardinalityValuesAssignment_5_2() { return cCardinalityValuesAssignment_5_2; }
		
		//CardinalityValue
		public RuleCall getCardinalityValuesCardinalityValueParserRuleCall_5_2_0() { return cCardinalityValuesCardinalityValueParserRuleCall_5_2_0; }
		
		//('components' modelElement+=GraphElementMapping modelElement+=GraphElementMapping*)?
		public Group getGroup_6() { return cGroup_6; }
		
		//'components'
		public Keyword getComponentsKeyword_6_0() { return cComponentsKeyword_6_0; }
		
		//modelElement+=GraphElementMapping
		public Assignment getModelElementAssignment_6_1() { return cModelElementAssignment_6_1; }
		
		//GraphElementMapping
		public RuleCall getModelElementGraphElementMappingParserRuleCall_6_1_0() { return cModelElementGraphElementMappingParserRuleCall_6_1_0; }
		
		//modelElement+=GraphElementMapping*
		public Assignment getModelElementAssignment_6_2() { return cModelElementAssignment_6_2; }
		
		//GraphElementMapping
		public RuleCall getModelElementGraphElementMappingParserRuleCall_6_2_0() { return cModelElementGraphElementMappingParserRuleCall_6_2_0; }
		
		//('ports' portMapping+=PortMapping portMapping+=PortMapping*)?
		public Group getGroup_7() { return cGroup_7; }
		
		//'ports'
		public Keyword getPortsKeyword_7_0() { return cPortsKeyword_7_0; }
		
		//portMapping+=PortMapping
		public Assignment getPortMappingAssignment_7_1() { return cPortMappingAssignment_7_1; }
		
		//PortMapping
		public RuleCall getPortMappingPortMappingParserRuleCall_7_1_0() { return cPortMappingPortMappingParserRuleCall_7_1_0; }
		
		//portMapping+=PortMapping*
		public Assignment getPortMappingAssignment_7_2() { return cPortMappingAssignment_7_2; }
		
		//PortMapping
		public RuleCall getPortMappingPortMappingParserRuleCall_7_2_0() { return cPortMappingPortMappingParserRuleCall_7_2_0; }
		
		//'}'
		public Keyword getRightCurlyBracketKeyword_8() { return cRightCurlyBracketKeyword_8; }
	}
	public class CardinalityValueElements extends AbstractParserRuleElementFinder {
		private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "com.irtsaintexupery.xtext.pseim.Mapping.CardinalityValue");
		private final Group cGroup = (Group)rule.eContents().get(1);
		private final Assignment cCardinalityElementAssignment_0 = (Assignment)cGroup.eContents().get(0);
		private final CrossReference cCardinalityElementCardinalityElementCrossReference_0_0 = (CrossReference)cCardinalityElementAssignment_0.eContents().get(0);
		private final RuleCall cCardinalityElementCardinalityElementQualifiedIDParserRuleCall_0_0_1 = (RuleCall)cCardinalityElementCardinalityElementCrossReference_0_0.eContents().get(1);
		private final Keyword cHyphenMinusGreaterThanSignKeyword_1 = (Keyword)cGroup.eContents().get(1);
		private final Assignment cValueAssignment_2 = (Assignment)cGroup.eContents().get(2);
		private final RuleCall cValueEIntParserRuleCall_2_0 = (RuleCall)cValueAssignment_2.eContents().get(0);
		
		//CardinalityValue mapping::CardinalityValue:
		//	cardinalityElement=[pseim::CardinalityElement|QualifiedID] '->' value=EInt;
		@Override public ParserRule getRule() { return rule; }
		
		//cardinalityElement=[pseim::CardinalityElement|QualifiedID] '->' value=EInt
		public Group getGroup() { return cGroup; }
		
		//cardinalityElement=[pseim::CardinalityElement|QualifiedID]
		public Assignment getCardinalityElementAssignment_0() { return cCardinalityElementAssignment_0; }
		
		//[pseim::CardinalityElement|QualifiedID]
		public CrossReference getCardinalityElementCardinalityElementCrossReference_0_0() { return cCardinalityElementCardinalityElementCrossReference_0_0; }
		
		//QualifiedID
		public RuleCall getCardinalityElementCardinalityElementQualifiedIDParserRuleCall_0_0_1() { return cCardinalityElementCardinalityElementQualifiedIDParserRuleCall_0_0_1; }
		
		//'->'
		public Keyword getHyphenMinusGreaterThanSignKeyword_1() { return cHyphenMinusGreaterThanSignKeyword_1; }
		
		//value=EInt
		public Assignment getValueAssignment_2() { return cValueAssignment_2; }
		
		//EInt
		public RuleCall getValueEIntParserRuleCall_2_0() { return cValueEIntParserRuleCall_2_0; }
	}
	public class PortMappingElements extends AbstractParserRuleElementFinder {
		private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "com.irtsaintexupery.xtext.pseim.Mapping.PortMapping");
		private final Group cGroup = (Group)rule.eContents().get(1);
		private final Assignment cModelPortAssignment_0 = (Assignment)cGroup.eContents().get(0);
		private final CrossReference cModelPortBorderElementCrossReference_0_0 = (CrossReference)cModelPortAssignment_0.eContents().get(0);
		private final RuleCall cModelPortBorderElementQualifiedIDParserRuleCall_0_0_1 = (RuleCall)cModelPortBorderElementCrossReference_0_0.eContents().get(1);
		private final Group cGroup_1 = (Group)cGroup.eContents().get(1);
		private final Keyword cCommaKeyword_1_0 = (Keyword)cGroup_1.eContents().get(0);
		private final Assignment cModelPortAssignment_1_1 = (Assignment)cGroup_1.eContents().get(1);
		private final CrossReference cModelPortBorderElementCrossReference_1_1_0 = (CrossReference)cModelPortAssignment_1_1.eContents().get(0);
		private final RuleCall cModelPortBorderElementQualifiedIDParserRuleCall_1_1_0_1 = (RuleCall)cModelPortBorderElementCrossReference_1_1_0.eContents().get(1);
		private final Keyword cHyphenMinusGreaterThanSignKeyword_2 = (Keyword)cGroup.eContents().get(2);
		private final Assignment cPatternPortAssignment_3 = (Assignment)cGroup.eContents().get(3);
		private final CrossReference cPatternPortBorderElementCrossReference_3_0 = (CrossReference)cPatternPortAssignment_3.eContents().get(0);
		private final RuleCall cPatternPortBorderElementQualifiedIDParserRuleCall_3_0_1 = (RuleCall)cPatternPortBorderElementCrossReference_3_0.eContents().get(1);
		
		//PortMapping mapping::PortMapping:
		//	modelPort+=[seim::BorderElement|QualifiedID] (',' modelPort+=[seim::BorderElement|QualifiedID])*
		//	'->'
		//	patternPort=[seim::BorderElement|QualifiedID];
		@Override public ParserRule getRule() { return rule; }
		
		//modelPort+=[seim::BorderElement|QualifiedID] (',' modelPort+=[seim::BorderElement|QualifiedID])* '->'
		//patternPort=[seim::BorderElement|QualifiedID]
		public Group getGroup() { return cGroup; }
		
		//modelPort+=[seim::BorderElement|QualifiedID]
		public Assignment getModelPortAssignment_0() { return cModelPortAssignment_0; }
		
		//[seim::BorderElement|QualifiedID]
		public CrossReference getModelPortBorderElementCrossReference_0_0() { return cModelPortBorderElementCrossReference_0_0; }
		
		//QualifiedID
		public RuleCall getModelPortBorderElementQualifiedIDParserRuleCall_0_0_1() { return cModelPortBorderElementQualifiedIDParserRuleCall_0_0_1; }
		
		//(',' modelPort+=[seim::BorderElement|QualifiedID])*
		public Group getGroup_1() { return cGroup_1; }
		
		//','
		public Keyword getCommaKeyword_1_0() { return cCommaKeyword_1_0; }
		
		//modelPort+=[seim::BorderElement|QualifiedID]
		public Assignment getModelPortAssignment_1_1() { return cModelPortAssignment_1_1; }
		
		//[seim::BorderElement|QualifiedID]
		public CrossReference getModelPortBorderElementCrossReference_1_1_0() { return cModelPortBorderElementCrossReference_1_1_0; }
		
		//QualifiedID
		public RuleCall getModelPortBorderElementQualifiedIDParserRuleCall_1_1_0_1() { return cModelPortBorderElementQualifiedIDParserRuleCall_1_1_0_1; }
		
		//'->'
		public Keyword getHyphenMinusGreaterThanSignKeyword_2() { return cHyphenMinusGreaterThanSignKeyword_2; }
		
		//patternPort=[seim::BorderElement|QualifiedID]
		public Assignment getPatternPortAssignment_3() { return cPatternPortAssignment_3; }
		
		//[seim::BorderElement|QualifiedID]
		public CrossReference getPatternPortBorderElementCrossReference_3_0() { return cPatternPortBorderElementCrossReference_3_0; }
		
		//QualifiedID
		public RuleCall getPatternPortBorderElementQualifiedIDParserRuleCall_3_0_1() { return cPatternPortBorderElementQualifiedIDParserRuleCall_3_0_1; }
	}
	public class GraphElementMappingElements extends AbstractParserRuleElementFinder {
		private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "com.irtsaintexupery.xtext.pseim.Mapping.GraphElementMapping");
		private final Group cGroup = (Group)rule.eContents().get(1);
		private final Assignment cModelGraphElementAssignment_0 = (Assignment)cGroup.eContents().get(0);
		private final CrossReference cModelGraphElementGraphElementCrossReference_0_0 = (CrossReference)cModelGraphElementAssignment_0.eContents().get(0);
		private final RuleCall cModelGraphElementGraphElementQualifiedIDParserRuleCall_0_0_1 = (RuleCall)cModelGraphElementGraphElementCrossReference_0_0.eContents().get(1);
		private final Group cGroup_1 = (Group)cGroup.eContents().get(1);
		private final Keyword cCommaKeyword_1_0 = (Keyword)cGroup_1.eContents().get(0);
		private final Assignment cModelGraphElementAssignment_1_1 = (Assignment)cGroup_1.eContents().get(1);
		private final CrossReference cModelGraphElementGraphElementCrossReference_1_1_0 = (CrossReference)cModelGraphElementAssignment_1_1.eContents().get(0);
		private final RuleCall cModelGraphElementGraphElementQualifiedIDParserRuleCall_1_1_0_1 = (RuleCall)cModelGraphElementGraphElementCrossReference_1_1_0.eContents().get(1);
		private final Keyword cHyphenMinusGreaterThanSignKeyword_2 = (Keyword)cGroup.eContents().get(2);
		private final Assignment cPatternGraphElementAssignment_3 = (Assignment)cGroup.eContents().get(3);
		private final CrossReference cPatternGraphElementGraphElementCrossReference_3_0 = (CrossReference)cPatternGraphElementAssignment_3.eContents().get(0);
		private final RuleCall cPatternGraphElementGraphElementQualifiedIDParserRuleCall_3_0_1 = (RuleCall)cPatternGraphElementGraphElementCrossReference_3_0.eContents().get(1);
		
		//GraphElementMapping mapping::GraphElementMapping:
		//	modelGraphElement+=[seim::GraphElement|QualifiedID] (',' modelGraphElement+=[seim::GraphElement|QualifiedID])*
		//	'->'
		//	patternGraphElement=[seim::GraphElement|QualifiedID];
		@Override public ParserRule getRule() { return rule; }
		
		//modelGraphElement+=[seim::GraphElement|QualifiedID] (',' modelGraphElement+=[seim::GraphElement|QualifiedID])* '->'
		//patternGraphElement=[seim::GraphElement|QualifiedID]
		public Group getGroup() { return cGroup; }
		
		//modelGraphElement+=[seim::GraphElement|QualifiedID]
		public Assignment getModelGraphElementAssignment_0() { return cModelGraphElementAssignment_0; }
		
		//[seim::GraphElement|QualifiedID]
		public CrossReference getModelGraphElementGraphElementCrossReference_0_0() { return cModelGraphElementGraphElementCrossReference_0_0; }
		
		//QualifiedID
		public RuleCall getModelGraphElementGraphElementQualifiedIDParserRuleCall_0_0_1() { return cModelGraphElementGraphElementQualifiedIDParserRuleCall_0_0_1; }
		
		//(',' modelGraphElement+=[seim::GraphElement|QualifiedID])*
		public Group getGroup_1() { return cGroup_1; }
		
		//','
		public Keyword getCommaKeyword_1_0() { return cCommaKeyword_1_0; }
		
		//modelGraphElement+=[seim::GraphElement|QualifiedID]
		public Assignment getModelGraphElementAssignment_1_1() { return cModelGraphElementAssignment_1_1; }
		
		//[seim::GraphElement|QualifiedID]
		public CrossReference getModelGraphElementGraphElementCrossReference_1_1_0() { return cModelGraphElementGraphElementCrossReference_1_1_0; }
		
		//QualifiedID
		public RuleCall getModelGraphElementGraphElementQualifiedIDParserRuleCall_1_1_0_1() { return cModelGraphElementGraphElementQualifiedIDParserRuleCall_1_1_0_1; }
		
		//'->'
		public Keyword getHyphenMinusGreaterThanSignKeyword_2() { return cHyphenMinusGreaterThanSignKeyword_2; }
		
		//patternGraphElement=[seim::GraphElement|QualifiedID]
		public Assignment getPatternGraphElementAssignment_3() { return cPatternGraphElementAssignment_3; }
		
		//[seim::GraphElement|QualifiedID]
		public CrossReference getPatternGraphElementGraphElementCrossReference_3_0() { return cPatternGraphElementGraphElementCrossReference_3_0; }
		
		//QualifiedID
		public RuleCall getPatternGraphElementGraphElementQualifiedIDParserRuleCall_3_0_1() { return cPatternGraphElementGraphElementQualifiedIDParserRuleCall_3_0_1; }
	}
	public class EIntElements extends AbstractParserRuleElementFinder {
		private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "com.irtsaintexupery.xtext.pseim.Mapping.EInt");
		private final Group cGroup = (Group)rule.eContents().get(1);
		private final Keyword cHyphenMinusKeyword_0 = (Keyword)cGroup.eContents().get(0);
		private final RuleCall cINTTerminalRuleCall_1 = (RuleCall)cGroup.eContents().get(1);
		
		//EInt ecore::EInt:
		//	'-'? INT;
		@Override public ParserRule getRule() { return rule; }
		
		//'-'? INT
		public Group getGroup() { return cGroup; }
		
		//'-'?
		public Keyword getHyphenMinusKeyword_0() { return cHyphenMinusKeyword_0; }
		
		//INT
		public RuleCall getINTTerminalRuleCall_1() { return cINTTerminalRuleCall_1; }
	}
	public class QualifiedIDElements extends AbstractParserRuleElementFinder {
		private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "com.irtsaintexupery.xtext.pseim.Mapping.QualifiedID");
		private final Group cGroup = (Group)rule.eContents().get(1);
		private final RuleCall cIDTerminalRuleCall_0 = (RuleCall)cGroup.eContents().get(0);
		private final Group cGroup_1 = (Group)cGroup.eContents().get(1);
		private final Keyword cFullStopKeyword_1_0 = (Keyword)cGroup_1.eContents().get(0);
		private final RuleCall cIDTerminalRuleCall_1_1 = (RuleCall)cGroup_1.eContents().get(1);
		
		//QualifiedID:
		//	ID ('.' ID)*;
		@Override public ParserRule getRule() { return rule; }
		
		//ID ('.' ID)*
		public Group getGroup() { return cGroup; }
		
		//ID
		public RuleCall getIDTerminalRuleCall_0() { return cIDTerminalRuleCall_0; }
		
		//('.' ID)*
		public Group getGroup_1() { return cGroup_1; }
		
		//'.'
		public Keyword getFullStopKeyword_1_0() { return cFullStopKeyword_1_0; }
		
		//ID
		public RuleCall getIDTerminalRuleCall_1_1() { return cIDTerminalRuleCall_1_1; }
	}
	
	
	private final PatternApplicationElements pPatternApplication;
	private final CardinalityValueElements pCardinalityValue;
	private final PortMappingElements pPortMapping;
	private final GraphElementMappingElements pGraphElementMapping;
	private final EIntElements pEInt;
	private final QualifiedIDElements pQualifiedID;
	
	private final Grammar grammar;
	
	private final TerminalsGrammarAccess gaTerminals;

	@Inject
	public MappingGrammarAccess(GrammarProvider grammarProvider,
			TerminalsGrammarAccess gaTerminals) {
		this.grammar = internalFindGrammar(grammarProvider);
		this.gaTerminals = gaTerminals;
		this.pPatternApplication = new PatternApplicationElements();
		this.pCardinalityValue = new CardinalityValueElements();
		this.pPortMapping = new PortMappingElements();
		this.pGraphElementMapping = new GraphElementMappingElements();
		this.pEInt = new EIntElements();
		this.pQualifiedID = new QualifiedIDElements();
	}
	
	protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
		Grammar grammar = grammarProvider.getGrammar(this);
		while (grammar != null) {
			if ("com.irtsaintexupery.xtext.pseim.Mapping".equals(grammar.getName())) {
				return grammar;
			}
			List<Grammar> grammars = grammar.getUsedGrammars();
			if (!grammars.isEmpty()) {
				grammar = grammars.iterator().next();
			} else {
				return null;
			}
		}
		return grammar;
	}
	
	@Override
	public Grammar getGrammar() {
		return grammar;
	}
	
	
	public TerminalsGrammarAccess getTerminalsGrammarAccess() {
		return gaTerminals;
	}

	
	//PatternApplication mapping::PatternApplication:
	//	'transform' model=[seim::Model] 'using' pattern=[pseim::Pattern] '{' ('multiplicity'
	//	cardinalityValues+=CardinalityValue cardinalityValues+=CardinalityValue*)? ('components'
	//	modelElement+=GraphElementMapping modelElement+=GraphElementMapping*)? ('ports' portMapping+=PortMapping
	//	portMapping+=PortMapping*)?
	//	'}';
	public PatternApplicationElements getPatternApplicationAccess() {
		return pPatternApplication;
	}
	
	public ParserRule getPatternApplicationRule() {
		return getPatternApplicationAccess().getRule();
	}
	
	//CardinalityValue mapping::CardinalityValue:
	//	cardinalityElement=[pseim::CardinalityElement|QualifiedID] '->' value=EInt;
	public CardinalityValueElements getCardinalityValueAccess() {
		return pCardinalityValue;
	}
	
	public ParserRule getCardinalityValueRule() {
		return getCardinalityValueAccess().getRule();
	}
	
	//PortMapping mapping::PortMapping:
	//	modelPort+=[seim::BorderElement|QualifiedID] (',' modelPort+=[seim::BorderElement|QualifiedID])*
	//	'->'
	//	patternPort=[seim::BorderElement|QualifiedID];
	public PortMappingElements getPortMappingAccess() {
		return pPortMapping;
	}
	
	public ParserRule getPortMappingRule() {
		return getPortMappingAccess().getRule();
	}
	
	//GraphElementMapping mapping::GraphElementMapping:
	//	modelGraphElement+=[seim::GraphElement|QualifiedID] (',' modelGraphElement+=[seim::GraphElement|QualifiedID])*
	//	'->'
	//	patternGraphElement=[seim::GraphElement|QualifiedID];
	public GraphElementMappingElements getGraphElementMappingAccess() {
		return pGraphElementMapping;
	}
	
	public ParserRule getGraphElementMappingRule() {
		return getGraphElementMappingAccess().getRule();
	}
	
	//EInt ecore::EInt:
	//	'-'? INT;
	public EIntElements getEIntAccess() {
		return pEInt;
	}
	
	public ParserRule getEIntRule() {
		return getEIntAccess().getRule();
	}
	
	//QualifiedID:
	//	ID ('.' ID)*;
	public QualifiedIDElements getQualifiedIDAccess() {
		return pQualifiedID;
	}
	
	public ParserRule getQualifiedIDRule() {
		return getQualifiedIDAccess().getRule();
	}
	
	//terminal ID:
	//	'^'? ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '0'..'9')*;
	public TerminalRule getIDRule() {
		return gaTerminals.getIDRule();
	}
	
	//terminal INT returns ecore::EInt:
	//	'0'..'9'+;
	public TerminalRule getINTRule() {
		return gaTerminals.getINTRule();
	}
	
	//terminal STRING:
	//	'"' ('\\' . | !('\\' | '"'))* '"' |
	//	"'" ('\\' . | !('\\' | "'"))* "'";
	public TerminalRule getSTRINGRule() {
		return gaTerminals.getSTRINGRule();
	}
	
	//terminal ML_COMMENT:
	//	'/*'->'*/';
	public TerminalRule getML_COMMENTRule() {
		return gaTerminals.getML_COMMENTRule();
	}
	
	//terminal SL_COMMENT:
	//	'//' !('\n' | '\r')* ('\r'? '\n')?;
	public TerminalRule getSL_COMMENTRule() {
		return gaTerminals.getSL_COMMENTRule();
	}
	
	//terminal WS:
	//	' ' | '\t' | '\r' | '\n'+;
	public TerminalRule getWSRule() {
		return gaTerminals.getWSRule();
	}
	
	//terminal ANY_OTHER:
	//	.;
	public TerminalRule getANY_OTHERRule() {
		return gaTerminals.getANY_OTHERRule();
	}
}
