當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。