private void extendModelElementsForEmptyStyle(final Component it) { TreeIterator<EObject> _eAllContents = it.eAllContents(); final Function1<EObject,Boolean> _function = new Function1<EObject,Boolean>() { public Boolean apply(final EObject it) { boolean _isBranchToSkip = DefaultComponentStyleStrategy.this.isBranchToSkip(it); boolean _not = (!_isBranchToSkip); return Boolean.valueOf(_not); } }; Iterator<EObject> _filter = IteratorExtensions.<EObject>filter(_eAllContents, _function); final Procedure1<EObject> _function_1 = new Procedure1<EObject>() { public void apply(final EObject it) { DefaultComponentStyleStrategy.this.extendModelElement(it, null); } }; IteratorExtensions.<EObject>forEach(_filter, _function_1); }
/** * Returns a set that contains all the unique entries of the given iterator in the order of their appearance. * The result set is a copy of the iterator with stable order. * * @param iterator * the iterator. May not be <code>null</code>. * @return a set with the unique entries of the given iterator. Never <code>null</code>. */ public static <T> Set<T> toSet(Iterator<? extends T> iterator) { return Sets.newLinkedHashSet(toIterable(iterator)); }
/** * Returns an iterable that performs the given {@code transformation} for each element of {@code original} when * requested. The mapping is done lazily. That is, subsequent iterations of the elements in the iterable will * repeatedly apply the transformation. * <p> * The transformation maps each element to an iterable, and all resulting iterables are combined to a single iterable. * Effectively a combination of {@link #map(Iterable, Function1)} and {@link #flatten(Iterable)} is performed. * </p> * <p> * The returned iterable's iterator <i>does not support {@code remove()}</i> in contrast to {@link #map(Iterable, Function1)}. * </p> * * @param original * the original iterable. May not be <code>null</code>. * @param transformation * the transformation. May not be <code>null</code> and must not yield <code>null</code>. * @return an iterable that provides the result of the transformation. Never <code>null</code>. * * @since 2.13 */ @Pure public static <T, R> Iterator<R> flatMap(Iterator<T> original, Function1<? super T, ? extends Iterator<R>> transformation) { return flatten(map(original, transformation)); }
final QueryParameterValue queryParameterValue = IteratorExtensions.<QueryParameterValue>findFirst(_filter_1, _function_1); _builder.newLineIfNotEmpty(); Iterator<QueryParameterValue> _filter_3 = IteratorExtensions.<QueryParameterValue>filter(_filter_2, _function_2); final Function1<QueryParameterValue,Attribute> _function_3 = new Function1<QueryParameterValue,Attribute>() { public Attribute apply(final QueryParameterValue e) { Iterator<Attribute> _map = IteratorExtensions.<QueryParameterValue, Attribute>map(_filter_3, _function_3); Set<Attribute> _set = IteratorExtensions.<Attribute>toSet(_map); final Function1<Attribute,String> _function_4 = new Function1<Attribute,String>() { public String apply(final Attribute e) {
/** * Applies {@code procedure} for each element of the given iterable. * * @param iterable * the iterable. May not be <code>null</code>. * @param procedure * the procedure. May not be <code>null</code>. */ public static <T> void forEach(Iterable<T> iterable, Procedure1<? super T> procedure) { IteratorExtensions.forEach(iterable.iterator(), procedure); }
private void addWarningsForOrphanedJvmElements(final Resource resource, final CancelIndicator monitor, final IAcceptor<Issue> acceptor) { final IssueSeverities issueSeverities = this.issueSeveritiesProvider.getIssueSeverities(resource); final Severity severity = issueSeverities.getSeverity(IssueCodes.ORPHAN_ELMENT); boolean _equals = Objects.equal(severity, Severity.IGNORE); if (_equals) { return; } Iterable<JvmDeclaredType> _filter = Iterables.<JvmDeclaredType>filter(IterableExtensions.<EObject>tail(resource.getContents()), JvmDeclaredType.class); for (final JvmDeclaredType jvmType : _filter) { final Function1<JvmMember, Boolean> _function = (JvmMember it) -> { boolean _isSynthetic = this._jvmTypeExtensions.isSynthetic(it); return Boolean.valueOf((!_isSynthetic)); }; Iterable<JvmMember> _iterable = IteratorExtensions.<JvmMember>toIterable(IteratorExtensions.<JvmMember>filter(Iterators.<JvmMember>filter(jvmType.eAllContents(), JvmMember.class), _function)); for (final JvmMember jvmMember : _iterable) { { this.operationCanceledManager.checkCanceled(monitor); final EObject sourceElement = this._iJvmModelAssociations.getPrimarySourceElement(jvmMember); if ((sourceElement == null)) { this.addWarningForOrphanedJvmElement(resource, jvmMember, severity, acceptor); } } } } }
if ((astRoot != null)) { final IResolvedTypes types = this.typeResolver.resolveTypes(astRoot); Iterable<XExpression> _filter = Iterables.<XExpression>filter(IteratorExtensions.<Object>toIterable(EcoreUtil.<Object>getAllContents(astRoot, true)), XExpression.class); for (final XExpression expression : _filter) { final Iterable<LightweightTypeReference> typesOfIdentifiables = IteratorExtensions.<LightweightTypeReference>toIterable(IteratorExtensions.<JvmIdentifiableElement, LightweightTypeReference>map(Iterators.<JvmIdentifiableElement>filter(EcoreUtil.<Object>getAllContents(eobject, true), JvmIdentifiableElement.class), _function)); for (final LightweightTypeReference typeRef : typesOfIdentifiables) { if ((typeRef != null)) {
public List<Variable> variables(final XExpression ex) { List<Variable> _xblockexpression = null; { final PatternBody body = EcoreUtil2.<PatternBody>getContainerOfType(ex, PatternBody.class); TreeIterator<EObject> _eAllContents = ex.eAllContents(); Iterator<XExpression> _iterator = CollectionLiterals.<XExpression>newImmutableList(ex).iterator(); final Function1<XFeatureCall, String> _function = (XFeatureCall it) -> { return it.getConcreteSyntaxFeatureName(); }; final List<String> valNames = IteratorExtensions.<String>toList(IteratorExtensions.<XFeatureCall, String>map(Iterators.<XFeatureCall>filter(Iterators.<EObject>concat(_eAllContents, _iterator), XFeatureCall.class), _function)); final Function1<Variable, Boolean> _function_1 = (Variable it) -> { return Boolean.valueOf(valNames.contains(it.getName())); }; final Function1<Variable, String> _function_2 = (Variable it) -> { return it.getName(); }; _xblockexpression = IterableExtensions.<Variable, String>sortBy(IterableExtensions.<Variable>filter(body.getVariables(), _function_1), _function_2); } return _xblockexpression; }
public List<Dao> getSubClassDaos(final Dao it) { Entity _entity = it.getEntity(); Model _model = this._types.model(_entity); TreeIterator<EObject> _eAllContents = _model.eAllContents(); Iterator<Dao> _filter = Iterators.<Dao>filter(_eAllContents, Dao.class); final Function1<Dao,Boolean> _function = new Function1<Dao,Boolean>() { public Boolean apply(final Dao e) { Entity _entity = e.getEntity(); Entity _superType = _entity.getSuperType(); Entity _entity_1 = it.getEntity(); boolean _equals = Objects.equal(_superType, _entity_1); return Boolean.valueOf(_equals); } }; Iterator<Dao> _filter_1 = IteratorExtensions.<Dao>filter(_filter, _function); List<Dao> _list = IteratorExtensions.<Dao>toList(_filter_1); final Function1<Dao,String> _function_1 = new Function1<Dao,String>() { public String apply(final Dao e) { String _name = e.getName(); return _name; } }; List<Dao> _sortBy = IterableExtensions.<Dao, String>sortBy(_list, _function_1); return _sortBy; }
public ArrayList<SecurityScheme> getAllUsedSecuritySchemes(final ZenModel model) { final ArrayList<SecurityScheme> result = Lists.<SecurityScheme>newArrayList(); SecuritySchemeLibrary _securitySchemesLibrary = model.getSecuritySchemesLibrary(); boolean _tripleNotEquals = (_securitySchemesLibrary != null); if (_tripleNotEquals) { result.addAll(model.getSecuritySchemesLibrary().getSecuritySchemes()); } final Function1<HasSecurityValue, EList<AuthenticationMethod>> _function = (HasSecurityValue it) -> { return it.getSecuredBy(); }; final Consumer<AuthenticationMethod> _function_1 = (AuthenticationMethod it) -> { result.add(it.getScheme()); }; Iterables.<AuthenticationMethod>concat(ListExtensions.<HasSecurityValue, EList<AuthenticationMethod>>map(IteratorExtensions.<HasSecurityValue>toList(Iterators.<HasSecurityValue>filter(model.eAllContents(), HasSecurityValue.class)), _function)).forEach(_function_1); return result; }
/** * Returns {@code true} if one or more elements in {@code iterable} satisfy the predicate. * * @param iterable * the iterable. May not be <code>null</code>. * @param predicate * the predicate. May not be <code>null</code>. * @return <code>true</code> if one or more elements in {@code iterable} satisfy the predicate. */ public static <T> boolean exists(Iterable<T> iterable, Function1<? super T, Boolean> predicate) { return IteratorExtensions.exists(iterable.iterator(), predicate); }
/** * Returns the first element in the given iterable or <code>null</code> if empty. * * @param iterable * the iterable. May not be <code>null</code>. * @return the first element in the iterable or <code>null</code>. */ public static <T> T head(Iterable<T> iterable) { return IteratorExtensions.head(iterable.iterator()); }
/** * Determines if the given iterator is <code>null</code> or contains no elements. * * @param iterator * the to-be-queried iterator. May be <code>null</code>. * @return {@code true} if the iterator is <code>null</code> or contains no elements */ public static boolean isNullOrEmpty(Iterator<?> iterator) { return iterator == null || isEmpty(iterator); }
/** * Finds the first element in the given iterable that fulfills the predicate. If none is found or the iterable is * empty, <code>null</code> is returned. * * @param iterable * the iterable. May not be <code>null</code>. * @param predicate * the predicate. May not be <code>null</code>. * @return the first element in the iterable for which the given predicate returns <code>true</code>, returns * <code>null</code> if no element matches the predicate or the iterable is empty. */ public static <T> T findFirst(Iterable<T> iterable, Function1<? super T, Boolean> predicate) { return IteratorExtensions.findFirst(iterable.iterator(), predicate); }
final QueryParameterValue value = IteratorExtensions.<QueryParameterValue>findFirst(_filter, _function_1); _builder.newLineIfNotEmpty(); Iterator<QueryParameterValue> _filter_2 = IteratorExtensions.<QueryParameterValue>filter(_filter_1, _function_2); final Function1<QueryParameterValue,Attribute> _function_3 = new Function1<QueryParameterValue,Attribute>() { public Attribute apply(final QueryParameterValue e) { Iterator<Attribute> _map = IteratorExtensions.<QueryParameterValue, Attribute>map(_filter_2, _function_3); Set<Attribute> _set = IteratorExtensions.<Attribute>toSet(_map); final Function1<Attribute,String> _function_4 = new Function1<Attribute,String>() { public String apply(final Attribute e) { TreeIterator<EObject> _eAllContents_2 = _statement_5.eAllContents(); Iterator<Join> _filter_3 = Iterators.<Join>filter(_eAllContents_2, Join.class); boolean _isEmpty_1 = IteratorExtensions.isEmpty(_filter_3); boolean _not_2 = (!_isEmpty_1); if (_not_2) {
/** * Applies {@code procedure} for each element of the given iterable. * * @param iterable * the iterable. May not be <code>null</code>. * @param procedure * the procedure. May not be <code>null</code>. */ public static <T> void forEach(Iterable<T> iterable, Procedure1<? super T> procedure) { IteratorExtensions.forEach(iterable.iterator(), procedure); }
List<EObject> _list = IteratorExtensions.<EObject>toList(_eAllContents); Iterable<ReferenceableByXmadslVariable> _filter = Iterables.<ReferenceableByXmadslVariable>filter(_list, ReferenceableByXmadslVariable.class); final Function1<ReferenceableByXmadslVariable,String> _function = new Function1<ReferenceableByXmadslVariable,String>() {
/** * Returns {@code true} if one or more elements in {@code iterable} satisfy the predicate. * * @param iterable * the iterable. May not be <code>null</code>. * @param predicate * the predicate. May not be <code>null</code>. * @return <code>true</code> if one or more elements in {@code iterable} satisfy the predicate. */ public static <T> boolean exists(Iterable<T> iterable, Function1<? super T, Boolean> predicate) { return IteratorExtensions.exists(iterable.iterator(), predicate); }
/** * Returns the first element in the given iterable or <code>null</code> if empty. * * @param iterable * the iterable. May not be <code>null</code>. * @return the first element in the iterable or <code>null</code>. */ public static <T> T head(Iterable<T> iterable) { return IteratorExtensions.head(iterable.iterator()); }