/*
 * generated by Xtext 2.11.0
 */
package org.xtext.example.mydsl.services;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.util.List;
import org.eclipse.xtext.Action;
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 MyDslGrammarAccess extends AbstractGrammarElementFinder {
	
	public class ModelElements extends AbstractParserRuleElementFinder {
		private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.xtext.example.mydsl.MyDsl.Model");
		private final Group cGroup = (Group)rule.eContents().get(1);
		private final Action cModelAction_0 = (Action)cGroup.eContents().get(0);
		private final Keyword cModelKeyword_1 = (Keyword)cGroup.eContents().get(1);
		private final Assignment cNameAssignment_2 = (Assignment)cGroup.eContents().get(2);
		private final RuleCall cNameIDTerminalRuleCall_2_0 = (RuleCall)cNameAssignment_2.eContents().get(0);
		private final Keyword cLeftCurlyBracketKeyword_3 = (Keyword)cGroup.eContents().get(3);
		private final Group cGroup_4 = (Group)cGroup.eContents().get(4);
		private final Keyword cClassAsKeyword_4_0 = (Keyword)cGroup_4.eContents().get(0);
		private final Keyword cLeftCurlyBracketKeyword_4_1 = (Keyword)cGroup_4.eContents().get(1);
		private final Assignment cClassAsAssignment_4_2 = (Assignment)cGroup_4.eContents().get(2);
		private final RuleCall cClassAsClassAParserRuleCall_4_2_0 = (RuleCall)cClassAsAssignment_4_2.eContents().get(0);
		private final Group cGroup_4_3 = (Group)cGroup_4.eContents().get(3);
		private final Keyword cCommaKeyword_4_3_0 = (Keyword)cGroup_4_3.eContents().get(0);
		private final Assignment cClassAsAssignment_4_3_1 = (Assignment)cGroup_4_3.eContents().get(1);
		private final RuleCall cClassAsClassAParserRuleCall_4_3_1_0 = (RuleCall)cClassAsAssignment_4_3_1.eContents().get(0);
		private final Keyword cRightCurlyBracketKeyword_4_4 = (Keyword)cGroup_4.eContents().get(4);
		private final Keyword cRightCurlyBracketKeyword_5 = (Keyword)cGroup.eContents().get(5);
		
		//Model:
		//	{Model}
		//	'Model'
		//	name=ID
		//	'{' ('classAs' '{' classAs+=ClassA ("," classAs+=ClassA)* '}')?
		//	'}';
		@Override public ParserRule getRule() { return rule; }
		
		//{Model} 'Model' name=ID '{' ('classAs' '{' classAs+=ClassA ("," classAs+=ClassA)* '}')? '}'
		public Group getGroup() { return cGroup; }
		
		//{Model}
		public Action getModelAction_0() { return cModelAction_0; }
		
		//'Model'
		public Keyword getModelKeyword_1() { return cModelKeyword_1; }
		
		//name=ID
		public Assignment getNameAssignment_2() { return cNameAssignment_2; }
		
		//ID
		public RuleCall getNameIDTerminalRuleCall_2_0() { return cNameIDTerminalRuleCall_2_0; }
		
		//'{'
		public Keyword getLeftCurlyBracketKeyword_3() { return cLeftCurlyBracketKeyword_3; }
		
		//('classAs' '{' classAs+=ClassA ("," classAs+=ClassA)* '}')?
		public Group getGroup_4() { return cGroup_4; }
		
		//'classAs'
		public Keyword getClassAsKeyword_4_0() { return cClassAsKeyword_4_0; }
		
		//'{'
		public Keyword getLeftCurlyBracketKeyword_4_1() { return cLeftCurlyBracketKeyword_4_1; }
		
		//classAs+=ClassA
		public Assignment getClassAsAssignment_4_2() { return cClassAsAssignment_4_2; }
		
		//ClassA
		public RuleCall getClassAsClassAParserRuleCall_4_2_0() { return cClassAsClassAParserRuleCall_4_2_0; }
		
		//("," classAs+=ClassA)*
		public Group getGroup_4_3() { return cGroup_4_3; }
		
		//","
		public Keyword getCommaKeyword_4_3_0() { return cCommaKeyword_4_3_0; }
		
		//classAs+=ClassA
		public Assignment getClassAsAssignment_4_3_1() { return cClassAsAssignment_4_3_1; }
		
		//ClassA
		public RuleCall getClassAsClassAParserRuleCall_4_3_1_0() { return cClassAsClassAParserRuleCall_4_3_1_0; }
		
		//'}'
		public Keyword getRightCurlyBracketKeyword_4_4() { return cRightCurlyBracketKeyword_4_4; }
		
		//'}'
		public Keyword getRightCurlyBracketKeyword_5() { return cRightCurlyBracketKeyword_5; }
	}
	public class ClassAElements extends AbstractParserRuleElementFinder {
		private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.xtext.example.mydsl.MyDsl.ClassA");
		private final Group cGroup = (Group)rule.eContents().get(1);
		private final Action cClassAAction_0 = (Action)cGroup.eContents().get(0);
		private final Keyword cClassAKeyword_1 = (Keyword)cGroup.eContents().get(1);
		private final Assignment cNameAssignment_2 = (Assignment)cGroup.eContents().get(2);
		private final RuleCall cNameIDTerminalRuleCall_2_0 = (RuleCall)cNameAssignment_2.eContents().get(0);
		private final Keyword cLeftCurlyBracketKeyword_3 = (Keyword)cGroup.eContents().get(3);
		private final Group cGroup_4 = (Group)cGroup.eContents().get(4);
		private final Keyword cClassbKeyword_4_0 = (Keyword)cGroup_4.eContents().get(0);
		private final Keyword cLeftCurlyBracketKeyword_4_1 = (Keyword)cGroup_4.eContents().get(1);
		private final Assignment cClassbAssignment_4_2 = (Assignment)cGroup_4.eContents().get(2);
		private final RuleCall cClassbClassBParserRuleCall_4_2_0 = (RuleCall)cClassbAssignment_4_2.eContents().get(0);
		private final Group cGroup_4_3 = (Group)cGroup_4.eContents().get(3);
		private final Keyword cCommaKeyword_4_3_0 = (Keyword)cGroup_4_3.eContents().get(0);
		private final Assignment cClassbAssignment_4_3_1 = (Assignment)cGroup_4_3.eContents().get(1);
		private final RuleCall cClassbClassBParserRuleCall_4_3_1_0 = (RuleCall)cClassbAssignment_4_3_1.eContents().get(0);
		private final Keyword cRightCurlyBracketKeyword_4_4 = (Keyword)cGroup_4.eContents().get(4);
		private final Keyword cRightCurlyBracketKeyword_5 = (Keyword)cGroup.eContents().get(5);
		
		//ClassA:
		//	{ClassA}
		//	'ClassA'
		//	name=ID
		//	'{' ('classb' '{' classb+=ClassB ("," classb+=ClassB)* '}')?
		//	'}';
		@Override public ParserRule getRule() { return rule; }
		
		//{ClassA} 'ClassA' name=ID '{' ('classb' '{' classb+=ClassB ("," classb+=ClassB)* '}')? '}'
		public Group getGroup() { return cGroup; }
		
		//{ClassA}
		public Action getClassAAction_0() { return cClassAAction_0; }
		
		//'ClassA'
		public Keyword getClassAKeyword_1() { return cClassAKeyword_1; }
		
		//name=ID
		public Assignment getNameAssignment_2() { return cNameAssignment_2; }
		
		//ID
		public RuleCall getNameIDTerminalRuleCall_2_0() { return cNameIDTerminalRuleCall_2_0; }
		
		//'{'
		public Keyword getLeftCurlyBracketKeyword_3() { return cLeftCurlyBracketKeyword_3; }
		
		//('classb' '{' classb+=ClassB ("," classb+=ClassB)* '}')?
		public Group getGroup_4() { return cGroup_4; }
		
		//'classb'
		public Keyword getClassbKeyword_4_0() { return cClassbKeyword_4_0; }
		
		//'{'
		public Keyword getLeftCurlyBracketKeyword_4_1() { return cLeftCurlyBracketKeyword_4_1; }
		
		//classb+=ClassB
		public Assignment getClassbAssignment_4_2() { return cClassbAssignment_4_2; }
		
		//ClassB
		public RuleCall getClassbClassBParserRuleCall_4_2_0() { return cClassbClassBParserRuleCall_4_2_0; }
		
		//("," classb+=ClassB)*
		public Group getGroup_4_3() { return cGroup_4_3; }
		
		//","
		public Keyword getCommaKeyword_4_3_0() { return cCommaKeyword_4_3_0; }
		
		//classb+=ClassB
		public Assignment getClassbAssignment_4_3_1() { return cClassbAssignment_4_3_1; }
		
		//ClassB
		public RuleCall getClassbClassBParserRuleCall_4_3_1_0() { return cClassbClassBParserRuleCall_4_3_1_0; }
		
		//'}'
		public Keyword getRightCurlyBracketKeyword_4_4() { return cRightCurlyBracketKeyword_4_4; }
		
		//'}'
		public Keyword getRightCurlyBracketKeyword_5() { return cRightCurlyBracketKeyword_5; }
	}
	public class ClassBElements extends AbstractParserRuleElementFinder {
		private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.xtext.example.mydsl.MyDsl.ClassB");
		private final Group cGroup = (Group)rule.eContents().get(1);
		private final Keyword cClassBKeyword_0 = (Keyword)cGroup.eContents().get(0);
		private final Assignment cNameAssignment_1 = (Assignment)cGroup.eContents().get(1);
		private final RuleCall cNameIDTerminalRuleCall_1_0 = (RuleCall)cNameAssignment_1.eContents().get(0);
		private final Keyword cLeftCurlyBracketKeyword_2 = (Keyword)cGroup.eContents().get(2);
		private final Keyword cTargetKeyword_3 = (Keyword)cGroup.eContents().get(3);
		private final Assignment cTargetAssignment_4 = (Assignment)cGroup.eContents().get(4);
		private final CrossReference cTargetClassACrossReference_4_0 = (CrossReference)cTargetAssignment_4.eContents().get(0);
		private final RuleCall cTargetClassAIDTerminalRuleCall_4_0_1 = (RuleCall)cTargetClassACrossReference_4_0.eContents().get(1);
		private final Keyword cRightCurlyBracketKeyword_5 = (Keyword)cGroup.eContents().get(5);
		
		//ClassB:
		//	'ClassB'
		//	name=ID
		//	'{'
		//	'target' target=[ClassA]
		//	'}';
		@Override public ParserRule getRule() { return rule; }
		
		//'ClassB' name=ID '{' 'target' target=[ClassA] '}'
		public Group getGroup() { return cGroup; }
		
		//'ClassB'
		public Keyword getClassBKeyword_0() { return cClassBKeyword_0; }
		
		//name=ID
		public Assignment getNameAssignment_1() { return cNameAssignment_1; }
		
		//ID
		public RuleCall getNameIDTerminalRuleCall_1_0() { return cNameIDTerminalRuleCall_1_0; }
		
		//'{'
		public Keyword getLeftCurlyBracketKeyword_2() { return cLeftCurlyBracketKeyword_2; }
		
		//'target'
		public Keyword getTargetKeyword_3() { return cTargetKeyword_3; }
		
		//target=[ClassA]
		public Assignment getTargetAssignment_4() { return cTargetAssignment_4; }
		
		//[ClassA]
		public CrossReference getTargetClassACrossReference_4_0() { return cTargetClassACrossReference_4_0; }
		
		//ID
		public RuleCall getTargetClassAIDTerminalRuleCall_4_0_1() { return cTargetClassAIDTerminalRuleCall_4_0_1; }
		
		//'}'
		public Keyword getRightCurlyBracketKeyword_5() { return cRightCurlyBracketKeyword_5; }
	}
	
	
	private final ModelElements pModel;
	private final ClassAElements pClassA;
	private final ClassBElements pClassB;
	
	private final Grammar grammar;
	
	private final TerminalsGrammarAccess gaTerminals;

	@Inject
	public MyDslGrammarAccess(GrammarProvider grammarProvider,
			TerminalsGrammarAccess gaTerminals) {
		this.grammar = internalFindGrammar(grammarProvider);
		this.gaTerminals = gaTerminals;
		this.pModel = new ModelElements();
		this.pClassA = new ClassAElements();
		this.pClassB = new ClassBElements();
	}
	
	protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
		Grammar grammar = grammarProvider.getGrammar(this);
		while (grammar != null) {
			if ("org.xtext.example.mydsl.MyDsl".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;
	}

	
	//Model:
	//	{Model}
	//	'Model'
	//	name=ID
	//	'{' ('classAs' '{' classAs+=ClassA ("," classAs+=ClassA)* '}')?
	//	'}';
	public ModelElements getModelAccess() {
		return pModel;
	}
	
	public ParserRule getModelRule() {
		return getModelAccess().getRule();
	}
	
	//ClassA:
	//	{ClassA}
	//	'ClassA'
	//	name=ID
	//	'{' ('classb' '{' classb+=ClassB ("," classb+=ClassB)* '}')?
	//	'}';
	public ClassAElements getClassAAccess() {
		return pClassA;
	}
	
	public ParserRule getClassARule() {
		return getClassAAccess().getRule();
	}
	
	//ClassB:
	//	'ClassB'
	//	name=ID
	//	'{'
	//	'target' target=[ClassA]
	//	'}';
	public ClassBElements getClassBAccess() {
		return pClassB;
	}
	
	public ParserRule getClassBRule() {
		return getClassBAccess().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();
	}
}
