本文整理汇总了Java中org.eclipse.xtext.xbase.lib.CollectionLiterals.newHashSet方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionLiterals.newHashSet方法的具体用法?Java CollectionLiterals.newHashSet怎么用?Java CollectionLiterals.newHashSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.xbase.lib.CollectionLiterals
的用法示例。
在下文中一共展示了CollectionLiterals.newHashSet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAllGrammarElementsUnique
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
@Test
public void testAllGrammarElementsUnique() {
try {
final ContentAssistFragmentTestLanguageRoot result = this.parseHelper.parse("newArrayList()");
Resource _eResource = result.eResource();
final XtextResource res = ((XtextResource) _eResource);
final ICompositeNode root = res.getParseResult().getRootNode();
new InvariantChecker().checkInvariant(root);
final HashSet<EObject> set = CollectionLiterals.<EObject>newHashSet();
BidiTreeIterable<INode> _asTreeIterable = root.getAsTreeIterable();
for (final INode node : _asTreeIterable) {
if ((node instanceof ICompositeNode)) {
EObject _grammarElement = ((ICompositeNode)node).getGrammarElement();
boolean _tripleNotEquals = (_grammarElement != null);
if (_tripleNotEquals) {
Assert.assertTrue(((ICompositeNode)node).getGrammarElement().toString(), set.add(((ICompositeNode)node).getGrammarElement()));
} else {
Assert.fail("node without grammar element");
}
}
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例2: testAllGrammarElementsUniqueAfterReparse
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
@Test
public void testAllGrammarElementsUniqueAfterReparse() {
try {
final ContentAssistFragmentTestLanguageRoot result = this.parseHelper.parse("");
Resource _eResource = result.eResource();
final XtextResource res = ((XtextResource) _eResource);
res.update(0, 0, "newArrayList()");
final ICompositeNode root = res.getParseResult().getRootNode();
final HashSet<EObject> set = CollectionLiterals.<EObject>newHashSet();
BidiTreeIterable<INode> _asTreeIterable = root.getAsTreeIterable();
for (final INode node : _asTreeIterable) {
if ((node instanceof ICompositeNode)) {
EObject _grammarElement = ((ICompositeNode)node).getGrammarElement();
boolean _tripleNotEquals = (_grammarElement != null);
if (_tripleNotEquals) {
Assert.assertTrue(((ICompositeNode)node).getGrammarElement().toString(), set.add(((ICompositeNode)node).getGrammarElement()));
} else {
Assert.fail("node without grammar element");
}
}
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例3: FlattenedGrammarAccess
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的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);
}
示例4: elementAliasToIdentifier
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
protected String elementAliasToIdentifier(final GrammarAlias.AbstractElementAlias alias) {
final Set<String> rulesSet = CollectionLiterals.<String>newHashSet();
final String body = this.elementAliasToIdentifier(alias, rulesSet, false);
final List<String> rulesList = CollectionLiterals.<String>newArrayList(((String[])Conversions.unwrapArray(rulesSet, String.class)));
ListExtensions.<String>sortInplace(rulesList);
final String rule = IterableExtensions.join(rulesList, "_");
return ((rule + "_") + body);
}
示例5: evaluate
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public Object evaluate(final XExpression it, final boolean validationMode) {
Object _xblockexpression = null;
{
HashSet<XExpression> _newHashSet = CollectionLiterals.<XExpression>newHashSet();
final SwitchConstantExpressionsInterpreter.SwitchContext ctx = new SwitchConstantExpressionsInterpreter.SwitchContext(null, null, null, _newHashSet);
ctx.validationMode = validationMode;
_xblockexpression = this.evaluate(it, ctx);
}
return _xblockexpression;
}
示例6: getFqFeatureNamesToExclude
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public static Set<String> getFqFeatureNamesToExclude(final Grammar grammar) {
Set<String> toExclude = CollectionLiterals.<String>newHashSet();
final Grammar superGrammar = ContentAssistFragmentExtensions.getSuperGrammar(grammar);
if ((superGrammar != null)) {
final Set<String> superGrammarsFqFeatureNames = ContentAssistFragmentExtensions.computeFqFeatureNamesFromSuperGrammars(grammar);
final Set<String> thisGrammarFqFeatureNames = IterableExtensions.<String>toSet(ContentAssistFragmentExtensions.computeFqFeatureNames(grammar));
toExclude = Sets.<String>intersection(thisGrammarFqFeatureNames, superGrammarsFqFeatureNames);
}
return toExclude;
}
示例7: computeFqFeatureNamesFromSuperGrammars
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
private static Set<String> computeFqFeatureNamesFromSuperGrammars(final Grammar grammar) {
Set<String> _xblockexpression = null;
{
final HashSet<Grammar> superGrammars = CollectionLiterals.<Grammar>newHashSet();
ContentAssistFragmentExtensions.computeAllSuperGrammars(grammar, superGrammars);
final Function1<Grammar, Iterable<String>> _function = (Grammar it) -> {
return ContentAssistFragmentExtensions.computeFqFeatureNames(it);
};
_xblockexpression = IterableExtensions.<String>toSet(Iterables.<String>concat(IterableExtensions.<Grammar, Iterable<String>>map(superGrammars, _function)));
}
return _xblockexpression;
}
示例8: usesXImportSection
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的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);
}
示例9: getReferencedEPackages
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
protected Set<EPackage> getReferencedEPackages(final List<EPackage> packs) {
final HashSet<EPackage> result = CollectionLiterals.<EPackage>newHashSet();
for (final EPackage pkg : packs) {
{
final TreeIterator<EObject> iterator = pkg.eAllContents();
while (iterator.hasNext()) {
{
final EObject obj = iterator.next();
EList<EObject> _eCrossReferences = obj.eCrossReferences();
for (final EObject crossRef : _eCrossReferences) {
boolean _eIsProxy = crossRef.eIsProxy();
if (_eIsProxy) {
URI _eProxyURI = ((InternalEObject) crossRef).eProxyURI();
String _plus = ("Proxy \'" + _eProxyURI);
String _plus_1 = (_plus + "\' could not be resolved");
EMFGeneratorFragment2.LOG.error(_plus_1);
} else {
final EPackage p = EcoreUtil2.<EPackage>getContainerOfType(crossRef, EPackage.class);
if ((p != null)) {
result.add(p);
}
}
}
}
}
}
}
result.removeAll(packs);
result.remove(EcorePackage.eINSTANCE);
result.remove(XMLTypePackage.eINSTANCE);
result.remove(XMLNamespacePackage.eINSTANCE);
return result;
}
示例10: getLinearListOfMandatoryAssignments
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public List<ISemanticSequencerNfaProvider.ISemState> getLinearListOfMandatoryAssignments(final IGrammarConstraintProvider.IConstraint constraint) {
final Nfa<ISemanticSequencerNfaProvider.ISemState> nfa = constraint.getNfa();
ISemanticSequencerNfaProvider.ISemState state = nfa.getStart();
final List<ISemanticSequencerNfaProvider.ISemState> result = CollectionLiterals.<ISemanticSequencerNfaProvider.ISemState>newArrayList();
final Set<EStructuralFeature> features = CollectionLiterals.<EStructuralFeature>newHashSet();
while ((state != null)) {
{
ISemanticSequencerNfaProvider.ISemState _stop = nfa.getStop();
boolean _tripleEquals = (state == _stop);
if (_tripleEquals) {
List<ISemanticSequencerNfaProvider.ISemState> _xifexpression = null;
boolean _isEmpty = result.isEmpty();
if (_isEmpty) {
_xifexpression = null;
} else {
_xifexpression = result;
}
return _xifexpression;
}
int _size = state.getFollowers().size();
boolean _tripleNotEquals = (_size != 1);
if (_tripleNotEquals) {
return null;
}
ISemanticSequencerNfaProvider.ISemState _start = nfa.getStart();
boolean _tripleNotEquals_1 = (state != _start);
if (_tripleNotEquals_1) {
final EStructuralFeature feature = state.getFeature();
if ((((feature == null) || feature.isMany()) || (!features.add(feature)))) {
return null;
}
result.add(state);
}
state = IterableExtensions.<ISemanticSequencerNfaProvider.ISemState>head(state.getFollowers());
}
}
return null;
}
示例11: ConstraintVisitingInfo
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public ConstraintVisitingInfo(final JvmTypeParameter initial) {
this.visiting = CollectionLiterals.<JvmTypeParameter>newHashSet(initial);
}
示例12: createSeenExpressionsSet
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
@BeforeClass
public static void createSeenExpressionsSet() {
AbstractClosureTypeTest2.seenExpressions = CollectionLiterals.<String>newHashSet();
}
示例13: createSeenExpressionsSet
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
@BeforeClass
public static void createSeenExpressionsSet() {
AbstractIdentifiableTypeTest.seenExpressions = CollectionLiterals.<String>newHashSet();
}
示例14: createSeenExpressionsSet
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
@BeforeClass
public static void createSeenExpressionsSet() {
AbstractFeatureCallTypeTest.seenExpressions = CollectionLiterals.<String>newHashSet();
}
示例15: createSeenExpressionsSet
import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
@BeforeClass
public static void createSeenExpressionsSet() {
AbstractClosureTypeTest.seenExpressions = CollectionLiterals.<String>newHashSet();
}