Java Code Examples for org.eclipse.xtext.xbase.lib.IterableExtensions#forall()

The following examples show how to use org.eclipse.xtext.xbase.lib.IterableExtensions#forall() . 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: ASTFlattenerUtils.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
public boolean canConvertToRichText(final InfixExpression node) {
  final FieldDeclaration parentFieldDecl = this.<FieldDeclaration>findParentOfType(node, FieldDeclaration.class);
  if ((parentFieldDecl != null)) {
    final TypeDeclaration typeDeclr = this.<TypeDeclaration>findParentOfType(parentFieldDecl, TypeDeclaration.class);
    if ((typeDeclr.isInterface() || (this.isFinal(parentFieldDecl.modifiers()) && this.isStatic(parentFieldDecl.modifiers())))) {
      return false;
    }
  }
  final SingleMemberAnnotation parentSingleMemberAnnotation = this.<SingleMemberAnnotation>findParentOfType(node, SingleMemberAnnotation.class);
  if ((parentSingleMemberAnnotation != null)) {
    return false;
  }
  final Iterable<StringLiteral> nodes = this.collectCompatibleNodes(node);
  return ((!IterableExtensions.isEmpty(nodes)) && IterableExtensions.<StringLiteral>forall(nodes, ((Function1<StringLiteral, Boolean>) (StringLiteral it) -> {
    return Boolean.valueOf(this.canTranslate(it));
  })));
}
 
Example 2
Source File: FormattableDocument.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected boolean isWhitespace(final String doc) {
  int _length = doc.length();
  int _minus = (_length - 1);
  final Function1<Integer, Boolean> _function = (Integer it) -> {
    return Boolean.valueOf(Character.isWhitespace(doc.charAt((it).intValue())));
  };
  return IterableExtensions.<Integer>forall(new IntegerRange(0, _minus), _function);
}
 
Example 3
Source File: AbstractIncrementalBuilderTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected boolean containsSuffix(final Iterable<? extends URI> uris, final String... suffixes) {
  final Function1<String, Boolean> _function = (String suffix) -> {
    final Function1<URI, Boolean> _function_1 = (URI uri) -> {
      return Boolean.valueOf(uri.toString().endsWith(suffix));
    };
    return Boolean.valueOf(IterableExtensions.exists(uris, _function_1));
  };
  return IterableExtensions.<String>forall(((Iterable<String>)Conversions.doWrapArray(suffixes)), _function);
}
 
Example 4
Source File: StateVectorExtensions.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Checks if all state vector positions are covered by states.
 */
public boolean isCompletelyCovered(final List<ExecutionState>[] finalStateImpactVector) {
  final Function1<List<ExecutionState>, Boolean> _function = (List<ExecutionState> l) -> {
    return Boolean.valueOf(((l != null) && (!l.isEmpty())));
  };
  return IterableExtensions.<List<ExecutionState>>forall(((Iterable<List<ExecutionState>>)Conversions.doWrapArray(finalStateImpactVector)), _function);
}
 
Example 5
Source File: FjTypeSystem.java    From xsemantics with Eclipse Public License 1.0 5 votes vote down vote up
protected Boolean applyAuxFunIsValue(final RuleApplicationTrace _trace_, final New exp) throws RuleFailedException {
  final Function1<Expression, Boolean> _function = new Function1<Expression, Boolean>() {
    public Boolean apply(final Expression it) {
      return FjTypeSystem.this.isValueInternal(_trace_, it);
    }
  };
  boolean _forall = IterableExtensions.<Expression>forall(exp.getArgs(), _function);
  /* exp.args.forall[isValue(it)] */
  if (!Boolean.valueOf(_forall)) {
    sneakyThrowRuleFailedException("exp.args.forall[isValue(it)]");
  }
  return Boolean.valueOf(_forall);
}
 
Example 6
Source File: AbstractExecutableBuilder.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public boolean isValid() {
  return (((IterableExtensions.<AbstractParameterBuilder>forall(this.parameterBuilders, ((Function1<AbstractParameterBuilder, Boolean>) (AbstractParameterBuilder it) -> {
    return Boolean.valueOf(it.isValid());
  })) && (!this.exceptions.contains(null))) && (!this.typeParameters.contains(null))) && super.isValid());
}
 
Example 7
Source File: JavaASTFlattener.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public boolean visit(final Initializer it) {
  Javadoc _javadoc = it.getJavadoc();
  boolean _tripleNotEquals = (_javadoc != null);
  if (_tripleNotEquals) {
    it.getJavadoc().accept(this);
  }
  this.appendModifiers(it, it.modifiers());
  boolean _isStatic = this._aSTFlattenerUtils.isStatic(it.modifiers());
  if (_isStatic) {
    if (((it.getParent() instanceof TypeDeclaration) && IterableExtensions.<FieldDeclaration>forall(IterableExtensions.<FieldDeclaration>filter(((Iterable<FieldDeclaration>)Conversions.doWrapArray(((TypeDeclaration) it.getParent()).getFields())), ((Function1<FieldDeclaration, Boolean>) (FieldDeclaration it_1) -> {
      return Boolean.valueOf((this._aSTFlattenerUtils.isStatic(it_1.modifiers()) && this._aSTFlattenerUtils.isFinal(it_1.modifiers())));
    })), ((Function1<FieldDeclaration, Boolean>) (FieldDeclaration f) -> {
      final Function1<VariableDeclarationFragment, Boolean> _function = (VariableDeclarationFragment fragment) -> {
        Boolean _isAssignedInBody = this._aSTFlattenerUtils.isAssignedInBody(it.getBody(), fragment);
        return Boolean.valueOf((!(_isAssignedInBody).booleanValue()));
      };
      return Boolean.valueOf(IterableExtensions.<VariableDeclarationFragment>forall(f.fragments(), _function));
    })))) {
      this.appendToBuffer(" final Void static_initializer = {");
      this.appendLineWrapToBuffer();
      it.getBody().accept(this);
      this.appendToBuffer("null }");
      this.appendLineWrapToBuffer();
    } else {
      this.addProblem(it, "Static initializer is not fully supported");
      this.appendToBuffer("{/*FIXME ");
      it.getBody().accept(this);
      this.appendToBuffer("*/}");
    }
  } else {
    ASTNode _parent = it.getParent();
    if ((_parent instanceof AnonymousClassDeclaration)) {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("Initializer is not supported in ");
      String _simpleName = ASTNode.nodeClassForType(it.getParent().getNodeType()).getSimpleName();
      _builder.append(_simpleName);
      this.addProblem(it, _builder.toString());
    }
    it.getBody().accept(this);
  }
  return false;
}