Java Code Examples for org.eclipse.xtext.xbase.lib.IterableExtensions#map()
The following examples show how to use
org.eclipse.xtext.xbase.lib.IterableExtensions#map() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeferredTypeParameterHintCollectorTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
public void hasNoHintsFor(final Map<JvmTypeParameter, LightweightMergedBoundTypeArgument> mapping, final String typeParamName) { final Set<JvmTypeParameter> allKeys = mapping.keySet(); for (final JvmTypeParameter key : allKeys) { String _simpleName = key.getSimpleName(); boolean _equals = Objects.equal(_simpleName, typeParamName); if (_equals) { LightweightTypeReference _typeReference = mapping.get(key).getTypeReference(); final UnboundTypeReference unbound = ((UnboundTypeReference) _typeReference); boolean _isEmpty = unbound.getAllHints().isEmpty(); boolean _not = (!_isEmpty); if (_not) { StringConcatenation _builder = new StringConcatenation(); _builder.append("Unexpected mapping for "); _builder.append(typeParamName); _builder.append(" in "); final Function1<JvmTypeParameter, String> _function = (JvmTypeParameter it) -> { return it.getSimpleName(); }; Iterable<String> _map = IterableExtensions.<JvmTypeParameter, String>map(mapping.keySet(), _function); _builder.append(_map); Assert.fail(_builder.toString()); } } } }
Example 2
Source File: ActualTypeArgumentMergeTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
public Pair<Map<JvmTypeParameter, List<LightweightBoundTypeArgument>>, LightweightMergedBoundTypeArgument> merge(final Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> mapping, final String typeParamName) { final Set<JvmTypeParameter> allKeys = mapping.keySet(); for (final JvmTypeParameter key : allKeys) { String _simpleName = key.getSimpleName(); boolean _equals = Objects.equal(_simpleName, typeParamName); if (_equals) { final List<LightweightBoundTypeArgument> mappingData = mapping.get(key); LightweightMergedBoundTypeArgument _merge = this.merger.merge(mappingData, this.getOwner()); return Pair.<Map<JvmTypeParameter, List<LightweightBoundTypeArgument>>, LightweightMergedBoundTypeArgument>of(mapping, _merge); } } StringConcatenation _builder = new StringConcatenation(); _builder.append("No mapping for "); _builder.append(typeParamName); _builder.append(" in "); final Function1<JvmTypeParameter, String> _function = (JvmTypeParameter it) -> { return it.getSimpleName(); }; Iterable<String> _map = IterableExtensions.<JvmTypeParameter, String>map(mapping.keySet(), _function); _builder.append(_map); Assert.fail(_builder.toString()); return null; }
Example 3
Source File: ResolvedExecutableImpl.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Override public Iterable<? extends ResolvedParameter> getResolvedParameters() { Iterable<? extends ResolvedParameter> _xblockexpression = null; { if ((this.resolvedParameters == null)) { int _size = this.getDelegate().getDeclaration().getParameters().size(); final Function1<Integer, ResolvedParameterImpl> _function = (Integer i) -> { ParameterDeclaration _parameterDeclaration = this.getCompilationUnit().toParameterDeclaration(this.getDelegate().getDeclaration().getParameters().get((i).intValue())); TypeReference _typeReference = this.getCompilationUnit().toTypeReference(this.getDelegate().getResolvedParameterTypes().get((i).intValue())); return new ResolvedParameterImpl(_parameterDeclaration, _typeReference); }; this.resolvedParameters = IterableExtensions.<Integer, ResolvedParameterImpl>map(new ExclusiveRange(0, _size, true), _function); } _xblockexpression = this.resolvedParameters; } return _xblockexpression; }
Example 4
Source File: AbstractLanguageServerTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
protected FileInfo initializeContext(final TextDocumentConfiguration configuration) { this.initialize(configuration.getInitializer()); boolean _isEmpty = configuration.getFilesInScope().isEmpty(); boolean _not = (!_isEmpty); if (_not) { final Function1<Map.Entry<String, CharSequence>, String> _function = (Map.Entry<String, CharSequence> it) -> { return this.writeFile(it.getKey(), it.getValue().toString()); }; final Iterable<String> createdFiles = IterableExtensions.<Map.Entry<String, CharSequence>, String>map(configuration.getFilesInScope().entrySet(), _function); this.didCreateWatchedFiles(((String[])Conversions.unwrapArray(createdFiles, String.class))); String _model = configuration.getModel(); boolean _tripleEquals = (_model == null); if (_tripleEquals) { String _head = IterableExtensions.<String>head(createdFiles); String _string = IterableExtensions.<Map.Entry<String, CharSequence>>head(configuration.getFilesInScope().entrySet()).getValue().toString(); return new FileInfo(_head, _string); } } Assert.assertNotNull(configuration.getModel()); final String filePath = this.writeFile(configuration.getFilePath(), configuration.getModel()); this.open(filePath, configuration.getModel()); String _model_1 = configuration.getModel(); return new FileInfo(filePath, _model_1); }
Example 5
Source File: AnnotationReferenceBuildContextImpl.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
protected void _setValue(final JvmTypeAnnotationValue it, final TypeReference[] value, final String componentType, final boolean mustBeArray) { EList<JvmTypeReference> _values = it.getValues(); final Function1<TypeReferenceImpl, JvmTypeReference> _function = (TypeReferenceImpl it_1) -> { return this.compilationUnit.toJvmTypeReference(it_1); }; Iterable<JvmTypeReference> _map = IterableExtensions.<TypeReferenceImpl, JvmTypeReference>map(Iterables.<TypeReferenceImpl>filter(((Iterable<?>)Conversions.doWrapArray(value)), TypeReferenceImpl.class), _function); Iterables.<JvmTypeReference>addAll(_values, _map); }
Example 6
Source File: ValidatorFragment.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public Iterable<EPackage> getGeneratedPackagesToValidate() { final Function1<GeneratedMetamodel, EPackage> _function = (GeneratedMetamodel it) -> { return it.getEPackage(); }; return IterableExtensions.<GeneratedMetamodel, EPackage>map(Iterables.<GeneratedMetamodel>filter(this.grammar.getMetamodelDeclarations(), GeneratedMetamodel.class), _function); }
Example 7
Source File: ValidatorFragment2.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected Iterable<EPackage> getGeneratedPackagesToValidate() { final Function1<GeneratedMetamodel, EPackage> _function = (GeneratedMetamodel it) -> { return it.getEPackage(); }; return IterableExtensions.<GeneratedMetamodel, EPackage>map(Iterables.<GeneratedMetamodel>filter(this.getGrammar().getMetamodelDeclarations(), GeneratedMetamodel.class), _function); }