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


Java UsedRulesFinder类代码示例

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


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

示例1: FlattenedGrammarAccess

import org.eclipse.xtext.xtext.UsedRulesFinder; //导入依赖的package包/类
public FlattenedGrammarAccess(final RuleNames names, final RuleFilter filter) {
  final Grammar grammar = names.getContextGrammar();
  Grammar flattenedGrammar = this.<Grammar>copy(grammar);
  flattenedGrammar.setName(grammar.getName());
  LinkedHashMap<RuleWithParameterValues, AbstractRule> origToCopy = Maps.<RuleWithParameterValues, AbstractRule>newLinkedHashMap();
  final ArrayList<AbstractRule> copies = this.copyRuleStubs(names, origToCopy, filter.getRules(grammar), filter.isDiscardRuleTypeRef());
  EList<AbstractRule> _rules = flattenedGrammar.getRules();
  Iterables.<AbstractRule>addAll(_rules, copies);
  Multimap<TerminalRule, AbstractRule> calledFrom = this.copyRuleBodies(copies, origToCopy);
  this.setHiddenTokens(flattenedGrammar, grammar, origToCopy);
  this.markAsFragment(calledFrom);
  boolean _isDiscardUnreachableRules = filter.isDiscardUnreachableRules();
  if (_isDiscardUnreachableRules) {
    Set<AbstractRule> usedRules = CollectionLiterals.<AbstractRule>newHashSet();
    boolean _isDiscardTerminalRules = filter.isDiscardTerminalRules();
    boolean _not = (!_isDiscardTerminalRules);
    if (_not) {
      usedRules.addAll(GrammarUtil.allTerminalRules(flattenedGrammar));
    }
    UsedRulesFinder finder = new UsedRulesFinder(usedRules);
    finder.compute(flattenedGrammar);
    flattenedGrammar.getRules().retainAll(usedRules);
  }
  this.flattenedGrammar = flattenedGrammar;
  new OriginalGrammar(grammar).attachToEmfObject(flattenedGrammar);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:27,代码来源:FlattenedGrammarAccess.java

示例2: usesXImportSection

import org.eclipse.xtext.xtext.UsedRulesFinder; //导入依赖的package包/类
/**
 * @since 2.4
 */
public boolean usesXImportSection(Grammar grammar) {
	Set<AbstractRule> usedRules = newHashSet();
	new UsedRulesFinder(usedRules).compute(grammar);
	return any(usedRules, new Predicate<AbstractRule>() {
		@Override
		public boolean apply(AbstractRule rule) {
			return equal(rule.getName(), "XImportSection") 
					&& equal(GrammarUtil.getGrammar(rule).getName(), "org.eclipse.xtext.xbase.Xtype");
		}
	});
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:15,代码来源:XbaseGeneratorFragment.java

示例3: usesXImportSection

import org.eclipse.xtext.xtext.UsedRulesFinder; //导入依赖的package包/类
public boolean usesXImportSection(final Grammar grammar) {
  final Set<AbstractRule> usedRules = CollectionLiterals.<AbstractRule>newHashSet();
  new UsedRulesFinder(usedRules).compute(grammar);
  final Function1<AbstractRule, Boolean> _function = (AbstractRule it) -> {
    return Boolean.valueOf((Objects.equal(it.getName(), "XImportSection") && Objects.equal(GrammarUtil.getGrammar(it).getName(), "org.eclipse.xtext.xbase.Xtype")));
  };
  return IterableExtensions.<AbstractRule>exists(usedRules, _function);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:9,代码来源:XbaseUsageDetector.java

示例4: usesXImportSection

import org.eclipse.xtext.xtext.UsedRulesFinder; //导入依赖的package包/类
@Override
public boolean usesXImportSection(final Grammar grammar) {
  Set<AbstractRule> usedRules = newHashSet();
  new UsedRulesFinder(usedRules).compute(grammar);
  return any(usedRules, new Predicate<AbstractRule>() {
    @Override
    public boolean apply(final AbstractRule rule) {
      return equal(rule.getName(), "XImportSection") && equal(rule.getType().getMetamodel().getEPackage().getName(), "xtype");
    }
  });
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:12,代码来源:FixedXbaseGeneratorFragment.java


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