当前位置: 首页>>代码示例>>Java>>正文


Java EcoreUtil2.eAllContents方法代码示例

本文整理汇总了Java中org.eclipse.xtext.EcoreUtil2.eAllContents方法的典型用法代码示例。如果您正苦于以下问题:Java EcoreUtil2.eAllContents方法的具体用法?Java EcoreUtil2.eAllContents怎么用?Java EcoreUtil2.eAllContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.xtext.EcoreUtil2的用法示例。


在下文中一共展示了EcoreUtil2.eAllContents方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rewriteKeywords

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
private static void rewriteKeywords(AbstractRule rule, N4JSKeywords keywords,
		ImmutableMap.Builder<AbstractElement, Integer> builder) {
	for (EObject obj : EcoreUtil2.eAllContents(rule.getAlternatives())) {
		if (obj instanceof Keyword) {
			Keyword keyword = (Keyword) obj;
			Integer type = keywords.getTokenType(keyword);
			if (type != null) {
				if (keyword.eContainer() instanceof EnumLiteralDeclaration) {
					builder.put((AbstractElement) keyword.eContainer(), type);
				} else {
					builder.put(keyword, type);
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:17,代码来源:TokenTypeRewriter.java

示例2: rewriteTypeReferences

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
private static void rewriteTypeReferences(N4JSGrammarAccess ga,
		ImmutableMap.Builder<AbstractElement, Integer> builder) {
	for (ParserRule rule : GrammarUtil.allParserRules(ga.getGrammar())) {
		for (EObject obj : EcoreUtil2.eAllContents(rule.getAlternatives())) {
			if (obj instanceof Assignment) {
				Assignment assignment = (Assignment) obj;
				AbstractElement terminal = assignment.getTerminal();
				if (terminal instanceof RuleCall) {
					AbstractRule calledRule = ((RuleCall) terminal).getRule();
					EClassifier classifier = calledRule.getType().getClassifier();
					if (classifier instanceof EClass
							&& TypeRefsPackage.Literals.TYPE_REF.isSuperTypeOf((EClass) classifier)) {
						builder.put(assignment, TYPE_REF_TOKEN);
					}
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:TokenTypeRewriter.java

示例3: rewriteIdentifiers

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
private static void rewriteIdentifiers(N4JSGrammarAccess ga,
		ImmutableMap.Builder<AbstractElement, Integer> builder) {
	ImmutableSet<AbstractRule> identifierRules = ImmutableSet.of(
			ga.getBindingIdentifierRule(),
			ga.getIdentifierNameRule(),
			ga.getIDENTIFIERRule());
	for (ParserRule rule : GrammarUtil.allParserRules(ga.getGrammar())) {
		for (EObject obj : EcoreUtil2.eAllContents(rule.getAlternatives())) {
			if (obj instanceof Assignment) {
				Assignment assignment = (Assignment) obj;
				AbstractElement terminal = assignment.getTerminal();
				int type = InternalN4JSParser.RULE_IDENTIFIER;
				if (terminal instanceof CrossReference) {
					terminal = ((CrossReference) terminal).getTerminal();
					type = IDENTIFIER_REF_TOKEN;
				}
				if (terminal instanceof RuleCall) {
					AbstractRule calledRule = ((RuleCall) terminal).getRule();
					if (identifierRules.contains(calledRule)) {
						builder.put(assignment, type);
					}
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:TokenTypeRewriter.java

示例4: rewriteNumberLiterals

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
private static void rewriteNumberLiterals(N4JSGrammarAccess ga,
		ImmutableMap.Builder<AbstractElement, Integer> builder) {
	for (ParserRule rule : GrammarUtil.allParserRules(ga.getGrammar())) {
		for (EObject obj : EcoreUtil2.eAllContents(rule.getAlternatives())) {
			if (obj instanceof Assignment) {
				Assignment assignment = (Assignment) obj;
				AbstractElement terminal = assignment.getTerminal();
				if (terminal instanceof RuleCall) {
					AbstractRule calledRule = ((RuleCall) terminal).getRule();
					EClassifier classifier = calledRule.getType().getClassifier();
					if (classifier == EcorePackage.Literals.EBIG_DECIMAL) {
						builder.put(assignment, NUMBER_LITERAL_TOKEN);
					}
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:TokenTypeRewriter.java


注:本文中的org.eclipse.xtext.EcoreUtil2.eAllContents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。