本文整理汇总了Java中org.eclipse.xtext.xbase.lib.IterableExtensions.toSet方法的典型用法代码示例。如果您正苦于以下问题:Java IterableExtensions.toSet方法的具体用法?Java IterableExtensions.toSet怎么用?Java IterableExtensions.toSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.xbase.lib.IterableExtensions
的用法示例。
在下文中一共展示了IterableExtensions.toSet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testNoReferenceDescriptionsForPackageFragments
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Test
public void testNoReferenceDescriptionsForPackageFragments() {
try {
final XExpression expression = this.expression("java::lang::String::valueOf(\"\")");
final Resource resource = expression.eResource();
final IResourceDescription description = this.resourceDescriptionManager.getResourceDescription(resource);
final Function1<IReferenceDescription, String> _function = (IReferenceDescription it) -> {
return it.getTargetEObjectUri().toString();
};
final Set<String> referenceDescriptions = IterableExtensions.<String>toSet(IterableExtensions.<IReferenceDescription, String>map(description.getReferenceDescriptions(), _function));
Assert.assertEquals(2, referenceDescriptions.size());
final Set<String> expectation = Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet("java:/Objects/java.lang.String#java.lang.String", "java:/Objects/java.lang.String#java.lang.String.valueOf(java.lang.Object)"));
Assert.assertEquals(expectation, referenceDescriptions);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例2: getDelegatedInterfaces
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public Set<TypeReference> getDelegatedInterfaces(final MemberDeclaration delegate) {
Set<TypeReference> _xblockexpression = null;
{
final Set<TypeReference> interfacesOfDeclaringType = this.getImplementedInterfaces(this.context.newSelfTypeReference(delegate.getDeclaringType()));
final Set<TypeReference> listedInterfaces = this.listedInterfaces(delegate);
final Set<TypeReference> availableInterfaces = this.getImplementedInterfaces(this.getType(delegate));
final Function1<TypeReference, Boolean> _function = new Function1<TypeReference, Boolean>() {
@Override
public Boolean apply(final TypeReference iface) {
return Boolean.valueOf((interfacesOfDeclaringType.contains(iface) && (listedInterfaces.isEmpty() || IterableExtensions.<TypeReference>exists(listedInterfaces, new Function1<TypeReference, Boolean>() {
@Override
public Boolean apply(final TypeReference it) {
return Boolean.valueOf(iface.isAssignableFrom(it));
}
}))));
}
};
_xblockexpression = IterableExtensions.<TypeReference>toSet(IterableExtensions.<TypeReference>filter(availableInterfaces, _function));
}
return _xblockexpression;
}
示例3: getFQFeatureNamesToExclude
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public Set<String> getFQFeatureNamesToExclude(final Grammar g) {
Set<String> _xifexpression = null;
Grammar _nonTerminalsSuperGrammar = GrammarUtil2.getNonTerminalsSuperGrammar(g);
boolean _tripleNotEquals = (_nonTerminalsSuperGrammar != null);
if (_tripleNotEquals) {
Sets.SetView<String> _xblockexpression = null;
{
final Set<String> thisGrammarFqFeatureNames = IterableExtensions.<String>toSet(this.computeFQFeatureNames(g));
final Function1<Grammar, Iterable<String>> _function = (Grammar it) -> {
return this.computeFQFeatureNames(it);
};
final Set<String> superGrammarsFqFeatureNames = IterableExtensions.<String>toSet(Iterables.<String>concat(ListExtensions.<Grammar, Iterable<String>>map(GrammarUtil.allUsedGrammars(g), _function)));
_xblockexpression = Sets.<String>intersection(thisGrammarFqFeatureNames, superGrammarsFqFeatureNames);
}
_xifexpression = _xblockexpression;
} else {
_xifexpression = CollectionLiterals.<String>emptySet();
}
return _xifexpression;
}
示例4: isAffected
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public boolean isAffected(final Collection<IResourceDescription.Delta> deltas, final IResourceDescription candidate, final IResourceDescriptions context) throws IllegalArgumentException {
Collection<QualifiedName> importedNames = IterableExtensions.<QualifiedName>toSet(candidate.getImportedNames());
for (final IResourceDescription.Delta delta : deltas) {
boolean _hasChanges = this.hasChanges(delta, candidate);
if (_hasChanges) {
if ((this.isAffected(importedNames, delta.getNew()) || this.isAffected(importedNames, delta.getOld()))) {
return true;
}
}
}
return false;
}
示例5: getFqFeatureNamesToExclude
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的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;
}
示例6: computeFqFeatureNamesFromSuperGrammars
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的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;
}
示例7: getClassAnnotations
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
private Set<IClassAnnotation> getClassAnnotations() {
final Function1<IClassAnnotation, Boolean> _function = (IClassAnnotation it) -> {
return Boolean.valueOf(it.appliesTo(this));
};
Iterable<IClassAnnotation> _filter = IterableExtensions.<IClassAnnotation>filter(this.codeConfig.getClassAnnotations(), _function);
return IterableExtensions.<IClassAnnotation>toSet(Iterables.<IClassAnnotation>concat(this.annotations, _filter));
}
示例8: getUpstreamProjects
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public Set<? extends ProjectDescriptor> getUpstreamProjects() {
RuntimeProjectDescriptor _runtimeProject = this.getConfig().getRuntimeProject();
IdeProjectDescriptor _ideProject = this.getConfig().getIdeProject();
final Function1<ProjectDescriptor, Boolean> _function = (ProjectDescriptor it) -> {
return Boolean.valueOf(it.isEnabled());
};
return IterableExtensions.toSet(IterableExtensions.filter(Collections.<ProjectDescriptor>unmodifiableList(CollectionLiterals.<ProjectDescriptor>newArrayList(_runtimeProject, _ideProject)), _function));
}
示例9: getSourceFolders
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public Set<String> getSourceFolders() {
final Function1<Outlet, String> _function = (Outlet it) -> {
return this.sourceFolder(it);
};
return IterableExtensions.<String>toSet(ListExtensions.<Outlet, String>map(Collections.<Outlet>unmodifiableList(CollectionLiterals.<Outlet>newArrayList(Outlet.TEST_JAVA, Outlet.TEST_RESOURCES, Outlet.TEST_SRC_GEN, Outlet.TEST_XTEND_GEN)), _function));
}
示例10: region
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public TraceRegionMergerTest.AssertBuilder region(final int offset, final int length, final int startLine, final int endLine, final List<String> uris, final Procedure1<? super TraceRegionMergerTest.AssertBuilder> init) {
TraceRegionMergerTest.AssertBuilder _xblockexpression = null;
{
final AbstractTraceRegion head = this.regions.poll();
Assert.assertEquals(head.toString(), offset, head.getMyOffset());
Assert.assertEquals(head.toString(), length, head.getMyLength());
Assert.assertEquals(head.toString(), startLine, head.getMyLineNumber());
Assert.assertEquals(head.toString(), endLine, head.getMyEndLineNumber());
final Function1<ILocationData, SourceRelativeURI> _function = (ILocationData it) -> {
return it.getSrcRelativePath();
};
final Set<SourceRelativeURI> associatedLocations = IterableExtensions.<SourceRelativeURI>toSet(ListExtensions.<ILocationData, SourceRelativeURI>map(head.getAssociatedLocations(), _function));
Assert.assertEquals(head.toString(), ((Object[])Conversions.unwrapArray(uris, Object.class)).length, ((Object[])Conversions.unwrapArray(associatedLocations, Object.class)).length);
for (final String uri : uris) {
URI _createURI = URI.createURI(uri);
SourceRelativeURI _sourceRelativeURI = new SourceRelativeURI(_createURI);
Assert.assertTrue(("Missing " + uri), associatedLocations.contains(_sourceRelativeURI));
}
if ((init == null)) {
Assert.assertTrue(head.getNestedRegions().isEmpty());
} else {
LinkedList<AbstractTraceRegion> _newLinkedList = CollectionLiterals.<AbstractTraceRegion>newLinkedList(((AbstractTraceRegion[])Conversions.unwrapArray(head.getNestedRegions(), AbstractTraceRegion.class)));
final TraceRegionMergerTest.AssertBuilder child = new TraceRegionMergerTest.AssertBuilder(this.testBuilder, _newLinkedList);
init.apply(child);
child.thatsIt();
}
_xblockexpression = this;
}
return _xblockexpression;
}
示例11: uniqueEntries
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
protected Set<String> uniqueEntries(final Iterable<String> pathes) {
final Function1<String, String> _function = (String it) -> {
return new File(it).getAbsolutePath();
};
return IterableExtensions.<String>toSet(IterableExtensions.<String, String>map(pathes, _function));
}
示例12: listedInterfaces
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public Set<TypeReference> listedInterfaces(final MemberDeclaration it) {
return IterableExtensions.<TypeReference>toSet(((Iterable<TypeReference>)Conversions.doWrapArray(it.findAnnotation(this.context.findTypeGlobally(Delegate.class)).getClassArrayValue("value"))));
}
示例13: _privk3_initialize
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
protected static void _privk3_initialize(final TransformationAspectTransformationAspectProperties _self_, final Transformation _self, final List<String> args) {
String _get = args.get(0);
TransformationAspect.inputModelURI(_self, _get);
String _get_1 = args.get(1);
TransformationAspect.outputFilePath(_self, _get_1);
Resource _eResource = _self.eResource();
final ResourceSet rs = _eResource.getResourceSet();
String _inputModelURI = TransformationAspect.inputModelURI(_self);
URI _createURI = URI.createURI(_inputModelURI);
final Resource inputModelResource = rs.getResource(_createURI, true);
Metamodel _inputMetamodel = _self.getInputMetamodel();
boolean _notEquals = (!Objects.equal(_inputMetamodel, null));
if (_notEquals) {
Metamodel _inputMetamodel_1 = _self.getInputMetamodel();
EList<EPackage> _packages = _inputMetamodel_1.getPackages();
final Function1<EPackage, Set<EClass>> _function = (EPackage p) -> {
TreeIterator<EObject> _eAllContents = p.eAllContents();
Iterator<EClass> _filter = Iterators.<EClass>filter(_eAllContents, EClass.class);
return IteratorExtensions.<EClass>toSet(_filter);
};
List<Set<EClass>> _map = ListExtensions.<EPackage, Set<EClass>>map(_packages, _function);
Iterable<EClass> _flatten = Iterables.<EClass>concat(_map);
final Set<EClass> allInputMetamodelClasses = IterableExtensions.<EClass>toSet(_flatten);
List<EObject> _inputModel = TransformationAspect.inputModel(_self);
TreeIterator<EObject> _allContents = inputModelResource.getAllContents();
Set<EObject> _set = IteratorExtensions.<EObject>toSet(_allContents);
_inputModel.addAll(_set);
List<EObject> _inputModel_1 = TransformationAspect.inputModel(_self);
for (final EObject o : _inputModel_1) {
EClass _eClass = o.eClass();
boolean _contains = allInputMetamodelClasses.contains(_eClass);
boolean _not = (!_contains);
if (_not) {
EClass _eClass_1 = o.eClass();
String _plus = ("The input model does not conform to the input metamodel: type " + _eClass_1);
String _plus_1 = (_plus + " of object ");
String _plus_2 = (_plus_1 + o);
String _plus_3 = (_plus_2 + " is unknown");
throw new RuntimeException(_plus_3);
}
}
}
}
示例14: getProjects
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public Set<? extends IProjectConfig> getProjects() {
return IterableExtensions.<IProjectConfig>toSet(this.projects.values());
}
示例15: getSourceFolders
import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public Set<String> getSourceFolders() {
final Function1<Outlet, String> _function = (Outlet it) -> {
return this.sourceFolder(it);
};
return IterableExtensions.<String>toSet(ListExtensions.<Outlet, String>map(Collections.<Outlet>unmodifiableList(CollectionLiterals.<Outlet>newArrayList(Outlet.MAIN_JAVA, Outlet.MAIN_RESOURCES, Outlet.MAIN_SRC_GEN, Outlet.MAIN_XTEND_GEN)), _function));
}