当前位置: 首页>>代码示例>>Java>>正文


Java IterableExtensions.isEmpty方法代码示例

本文整理汇总了Java中org.eclipse.xtext.xbase.lib.IterableExtensions.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java IterableExtensions.isEmpty方法的具体用法?Java IterableExtensions.isEmpty怎么用?Java IterableExtensions.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.xtext.xbase.lib.IterableExtensions的用法示例。


在下文中一共展示了IterableExtensions.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _privk3_step

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
protected static void _privk3_step(final StateAspectStateAspectProperties _self_, final State _self, final String inputString) {
  try {
    final Function1<Transition, Boolean> _function = (Transition t) -> {
      return Boolean.valueOf(inputString.startsWith(t.getInput()));
    };
    final Iterable<Transition> validTransitions = IterableExtensions.<Transition>filter(_self.getOutgoingTransitions(), _function);
    boolean _isEmpty = IterableExtensions.isEmpty(validTransitions);
    if (_isEmpty) {
      throw new Exception("No Transition");
    }
    int _size = IterableExtensions.size(validTransitions);
    boolean _greaterThan = (_size > 1);
    if (_greaterThan) {
      throw new Exception("Non Determinism");
    }
    TransitionAspect.fire(((Transition[])Conversions.unwrapArray(validTransitions, Transition.class))[0]);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:21,代码来源:StateAspect.java

示例2: forEach

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
 * Iterates elements and execute the procedure.
 * A prefix, a separator and a suffix can be initialized with the loopInitializer lambda.
 */
public <T extends Object> void forEach(final ITreeAppendable appendable, final Iterable<T> elements, final Procedure1<? super LoopParams> loopInitializer, final Procedure1<? super T> procedure) {
  boolean _isEmpty = IterableExtensions.isEmpty(elements);
  if (_isEmpty) {
    return;
  }
  LoopParams _loopParams = new LoopParams();
  final LoopParams params = ObjectExtensions.<LoopParams>operator_doubleArrow(_loopParams, loopInitializer);
  params.appendPrefix(appendable);
  T _head = IterableExtensions.<T>head(elements);
  ObjectExtensions.<T>operator_doubleArrow(_head, procedure);
  final Consumer<T> _function = (T it) -> {
    params.appendSeparator(appendable);
    ObjectExtensions.<T>operator_doubleArrow(it, procedure);
  };
  IterableExtensions.<T>tail(elements).forEach(_function);
  params.appendSuffix(appendable);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:22,代码来源:LoopExtensions.java

示例3: isSupportedGetter

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public boolean isSupportedGetter(final ResolvedMethod it) {
  boolean _isEmpty = IterableExtensions.isEmpty(it.getDeclaration().getParameters());
  boolean _not = (!_isEmpty);
  if (_not) {
    return false;
  }
  boolean _isStatic = it.getDeclaration().isStatic();
  if (_isStatic) {
    return false;
  }
  final String n = it.getDeclaration().getSimpleName();
  String _qualifiedName = it.getDeclaration().getDeclaringType().getQualifiedName();
  String _name = Object.class.getName();
  boolean _equals = Objects.equal(_qualifiedName, _name);
  if (_equals) {
    return false;
  }
  return (n.startsWith("get") || n.startsWith("is"));
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:20,代码来源:TracedAccessorsProcessor.java

示例4: needsDispatcherRule

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public static boolean needsDispatcherRule(final EClassifier eClassifier) {
  boolean _switchResult = false;
  boolean _matched = false;
  if (eClassifier instanceof EClass) {
    _matched=true;
    final Function1<EClass, Boolean> _function = (EClass c) -> {
      return Boolean.valueOf(Ecore2XtextExtensions.needsConcreteRule(c));
    };
    boolean _isEmpty = IterableExtensions.isEmpty(IterableExtensions.<EClass>filter(Ecore2XtextExtensions.subClasses(((EClass)eClassifier)), _function));
    _switchResult = (!_isEmpty);
  }
  if (!_matched) {
    _switchResult = false;
  }
  return _switchResult;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:17,代码来源:Ecore2XtextExtensions.java

示例5: doVisitWildcardTypeReference

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
protected void doVisitWildcardTypeReference(final WildcardTypeReference reference) {
  this.appender.append("?");
  LightweightTypeReference _lowerBound = reference.getLowerBound();
  boolean _tripleNotEquals = (_lowerBound != null);
  if (_tripleNotEquals) {
    this.appender.append(" super ");
    reference.getLowerBound().accept(this);
  } else {
    final Function1<LightweightTypeReference, Boolean> _function = (LightweightTypeReference it) -> {
      String _identifier = it.getIdentifier();
      return Boolean.valueOf((!Objects.equal("java.lang.Object", _identifier)));
    };
    final Iterable<LightweightTypeReference> relevantUpperBounds = IterableExtensions.<LightweightTypeReference>filter(reference.getUpperBounds(), _function);
    boolean _isEmpty = IterableExtensions.isEmpty(relevantUpperBounds);
    boolean _not = (!_isEmpty);
    if (_not) {
      this.appender.append(" extends ");
      boolean isFirst = true;
      for (final LightweightTypeReference upperBound : relevantUpperBounds) {
        {
          if ((!isFirst)) {
            this.appender.append(" & ");
          }
          isFirst = false;
          upperBound.accept(this);
        }
      }
    }
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:32,代码来源:LightweightTypeReferenceSerializer.java

示例6: getDirectErrorsOrLogicallyContainedErrors

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
 * Returns the errors that are produced for elements that are directly contained
 * in this feature (e.g. unresolved type proxies) or that are associated with
 * the expression that may be logically contained in the given feature.
 */
private Iterable<Issue> getDirectErrorsOrLogicallyContainedErrors(final JvmFeature feature) {
  Iterable<Issue> errors = this._errorSafeExtensions.getErrors(feature);
  boolean _isEmpty = IterableExtensions.isEmpty(errors);
  if (_isEmpty) {
    final XExpression expression = this._iLogicalContainerProvider.getAssociatedExpression(feature);
    if ((expression != null)) {
      errors = this._errorSafeExtensions.getErrors(expression);
    }
  }
  return errors;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:17,代码来源:JvmModelGenerator.java

示例7: findTasks

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public List<Task> findTasks(final Resource resource) {
  List<Task> _xblockexpression = null;
  {
    final TaskTags taskTags = this.taskTagProvider.getTaskTags(resource);
    boolean _isEmpty = IterableExtensions.isEmpty(taskTags);
    if (_isEmpty) {
      return Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList());
    }
    List<Task> _xifexpression = null;
    if ((resource instanceof XtextResource)) {
      List<Task> _elvis = null;
      IParseResult _parseResult = ((XtextResource)resource).getParseResult();
      ICompositeNode _rootNode = null;
      if (_parseResult!=null) {
        _rootNode=_parseResult.getRootNode();
      }
      List<Task> _findTasks = null;
      if (_rootNode!=null) {
        _findTasks=this.findTasks(_rootNode, taskTags);
      }
      if (_findTasks != null) {
        _elvis = _findTasks;
      } else {
        _elvis = Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList());
      }
      _xifexpression = _elvis;
    } else {
      _xifexpression = Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList());
    }
    _xblockexpression = _xifexpression;
  }
  return _xblockexpression;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:35,代码来源:DefaultTaskFinder.java

示例8: parseTasks

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public List<Task> parseTasks(final String source, final TaskTags taskTags) {
  ArrayList<Task> _xblockexpression = null;
  {
    boolean _isEmpty = IterableExtensions.isEmpty(taskTags);
    if (_isEmpty) {
      return Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList());
    }
    final Function<TaskTag, String> _function = (TaskTag it) -> {
      return it.getName().toLowerCase();
    };
    final ImmutableMap<String, TaskTag> taskTagsByName = Maps.<String, TaskTag>uniqueIndex(taskTags, _function);
    final Matcher matcher = this.toPattern(taskTags).matcher(source);
    final ArrayList<Task> tasks = CollectionLiterals.<Task>newArrayList();
    int prevLine = 1;
    int prevOffset = 0;
    while (matcher.find()) {
      {
        final Task task = new Task();
        task.setTag(taskTagsByName.get(matcher.group(2).toLowerCase()));
        task.setDescription(matcher.group(3));
        task.setOffset(matcher.start(2));
        int _countLineBreaks = Strings.countLineBreaks(source, prevOffset, task.getOffset());
        int _plus = (_countLineBreaks + prevLine);
        task.setLineNumber(_plus);
        prevLine = task.getLineNumber();
        prevOffset = task.getOffset();
        tasks.add(task);
      }
    }
    _xblockexpression = tasks;
  }
  return _xblockexpression;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:35,代码来源:DefaultTaskParser.java

示例9: getPackageName

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
private static String getPackageName(final String qualifiedName, final boolean strict) {
  final List<String> segments = IterableExtensions.<String>toList(Splitter.on(".").split(qualifiedName));
  int _size = segments.size();
  boolean _equals = (_size == 1);
  if (_equals) {
    return "";
  }
  if (strict) {
    int _length = ((Object[])Conversions.unwrapArray(segments, Object.class)).length;
    int _minus = (_length - 1);
    final List<String> packageSegments = segments.subList(0, _minus);
    final Function1<String, Boolean> _function = (String it) -> {
      return Boolean.valueOf(Character.isUpperCase(it.charAt(0)));
    };
    boolean _isEmpty = IterableExtensions.isEmpty(IterableExtensions.<String>filter(packageSegments, _function));
    boolean _not = (!_isEmpty);
    if (_not) {
      throw new IllegalArgumentException((("Cannot determine the package name of \'" + qualifiedName) + "\'. Please use the TypeReference(packageName, className) constructor"));
    }
    return IterableExtensions.join(packageSegments, ".");
  } else {
    int _length_1 = ((Object[])Conversions.unwrapArray(segments, Object.class)).length;
    int _minus_1 = (_length_1 - 1);
    List<String> packageSegments_1 = segments.subList(0, _minus_1);
    while ((!packageSegments_1.isEmpty())) {
      boolean _isUpperCase = Character.isUpperCase(IterableExtensions.<String>last(packageSegments_1).charAt(0));
      if (_isUpperCase) {
        final List<String> _converted_packageSegments_1 = (List<String>)packageSegments_1;
        int _length_2 = ((Object[])Conversions.unwrapArray(_converted_packageSegments_1, Object.class)).length;
        int _minus_2 = (_length_2 - 1);
        packageSegments_1 = packageSegments_1.subList(0, _minus_2);
      } else {
        return IterableExtensions.join(packageSegments_1, ".");
      }
    }
    return "";
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:39,代码来源:TypeReference.java

示例10: compileParserImports

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
protected String compileParserImports(final Grammar it, final AntlrOptions options) {
  StringConcatenation _builder = new StringConcatenation();
  _builder.newLine();
  _builder.append("import ");
  String _name = this.getGrammarNaming().getInternalParserSuperClass(it).getName();
  _builder.append(_name);
  _builder.append(";");
  _builder.newLineIfNotEmpty();
  _builder.append("import ");
  TypeReference _elementTypeProvider = this._ideaPluginClassNames.getElementTypeProvider(GrammarUtil.getGrammar(it));
  _builder.append(_elementTypeProvider);
  _builder.append(";");
  _builder.newLineIfNotEmpty();
  _builder.append("import org.eclipse.xtext.idea.parser.TokenTypeProvider;");
  _builder.newLine();
  _builder.append("import org.eclipse.xtext.parser.antlr.XtextTokenStream;");
  _builder.newLine();
  _builder.append("import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens;");
  _builder.newLine();
  {
    if (((!IterableExtensions.isEmpty(Iterables.<UnorderedGroup>filter(Iterables.<EObject>concat(ListExtensions.<ParserRule, List<EObject>>map(GrammarUtil.allParserRules(it), ((Function1<ParserRule, List<EObject>>) (ParserRule it_1) -> {
      return EcoreUtil2.eAllContentsAsList(it_1);
    }))), UnorderedGroup.class))) && options.isBacktrack())) {
      _builder.append("import org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState;");
      _builder.newLine();
    }
  }
  _builder.append("import ");
  String _name_1 = this._grammarAccessExtensions.getGrammarAccess(it).getName();
  _builder.append(_name_1);
  _builder.append(";");
  _builder.newLineIfNotEmpty();
  _builder.newLine();
  _builder.append("import com.intellij.lang.PsiBuilder;");
  _builder.newLine();
  return _builder.toString();
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:39,代码来源:PsiAntlrGrammarGenerator.java

示例11: buildPropertiesEntry

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
private String buildPropertiesEntry(final String key, final Iterable<String> value) {
  String _xblockexpression = null;
  {
    boolean _isEmpty = IterableExtensions.isEmpty(value);
    if (_isEmpty) {
      return "";
    }
    final String assignment = (key + " = ");
    final String indent = Strings.repeat(" ", assignment.length());
    String _join = IterableExtensions.join(value, (",\\\n" + indent));
    _xblockexpression = (assignment + _join);
  }
  return _xblockexpression;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:ProjectDescriptor.java

示例12: manifestEntry

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
private String manifestEntry(final String key, final Iterable<String> value) {
  boolean _isEmpty = IterableExtensions.isEmpty(value);
  if (_isEmpty) {
    return "";
  }
  StringConcatenation _builder = new StringConcatenation();
  _builder.append(key);
  _builder.append(": ");
  String _join = IterableExtensions.join(value, ",\n ");
  _builder.append(_join);
  return _builder.toString();
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:13,代码来源:ProjectDescriptor.java

示例13: onlyOptionalFeatures

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public static boolean onlyOptionalFeatures(final EClass it) {
  boolean _xblockexpression = false;
  {
    Iterable<EStructuralFeature> _prefixFeatures = Ecore2XtextExtensions.prefixFeatures(it);
    Iterable<EStructuralFeature> _inlinedFeatures = Ecore2XtextExtensions.inlinedFeatures(it);
    final Iterable<EStructuralFeature> features = Iterables.<EStructuralFeature>concat(_prefixFeatures, _inlinedFeatures);
    final Function1<EStructuralFeature, Boolean> _function = (EStructuralFeature f) -> {
      return Boolean.valueOf(f.isRequired());
    };
    _xblockexpression = IterableExtensions.isEmpty(IterableExtensions.<EStructuralFeature>filter(features, _function));
  }
  return _xblockexpression;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:14,代码来源:Ecore2XtextExtensions.java

示例14: forEachSafely

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public <T extends EObject> void forEachSafely(final ITreeAppendable appendable, final Iterable<T> elements, final Procedure1<? super LoopParams> loopInitializer, final Procedure2<? super T, ? super ITreeAppendable> body) {
  boolean _isEmpty = IterableExtensions.isEmpty(elements);
  if (_isEmpty) {
    return;
  }
  LoopParams _loopParams = new LoopParams();
  final LoopParams loopParams = ObjectExtensions.<LoopParams>operator_doubleArrow(_loopParams, loopInitializer);
  final Function1<T, Boolean> _function = (T it) -> {
    return Boolean.valueOf(this.hasErrors(it));
  };
  int _size = IterableExtensions.size(IterableExtensions.<T>filter(elements, _function));
  int _size_1 = IterableExtensions.size(elements);
  final boolean allElementsBroken = (_size == _size_1);
  ITreeAppendable _xifexpression = null;
  if (allElementsBroken) {
    _xifexpression = this.openErrorAppendable(appendable, null);
  } else {
    _xifexpression = appendable;
  }
  ITreeAppendable currentAppendable = _xifexpression;
  loopParams.appendPrefix(currentAppendable);
  boolean isFirst = true;
  boolean isFirstBroken = true;
  for (final T element : elements) {
    boolean _hasErrors = this.hasErrors(element);
    boolean _not = (!_hasErrors);
    if (_not) {
      currentAppendable = this.closeErrorAppendable(appendable, currentAppendable);
      if ((!isFirst)) {
        loopParams.appendSeparator(appendable);
      }
      isFirst = false;
      body.apply(element, appendable);
    } else {
      if ((!allElementsBroken)) {
        currentAppendable = this.openErrorAppendable(appendable, currentAppendable);
      }
      if (((!isFirst) || (!isFirstBroken))) {
        loopParams.appendSeparator(currentAppendable);
      }
      isFirstBroken = false;
      try {
        body.apply(element, currentAppendable);
      } catch (final Throwable _t) {
        if (_t instanceof Exception) {
        } else {
          throw Exceptions.sneakyThrow(_t);
        }
      }
    }
  }
  ITreeAppendable _xifexpression_1 = null;
  if (allElementsBroken) {
    _xifexpression_1 = currentAppendable;
  } else {
    _xifexpression_1 = this.closeErrorAppendable(appendable, currentAppendable);
  }
  currentAppendable = _xifexpression_1;
  loopParams.appendSuffix(currentAppendable);
  this.closeErrorAppendable(appendable, currentAppendable);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:62,代码来源:ErrorSafeExtensions.java

示例15: generateInitialization

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public void generateInitialization(final JvmField it, final ITreeAppendable appendable, final GeneratorConfig config) {
  Procedure1<? super ITreeAppendable> _compilationStrategy = this._jvmTypeExtensions.getCompilationStrategy(it);
  boolean _tripleNotEquals = (_compilationStrategy != null);
  if (_tripleNotEquals) {
    final Iterable<Issue> errors = this.getDirectErrorsOrLogicallyContainedErrors(it);
    boolean _isEmpty = IterableExtensions.isEmpty(errors);
    if (_isEmpty) {
      appendable.append(" = ");
      appendable.increaseIndentation();
      this._jvmTypeExtensions.getCompilationStrategy(it).apply(appendable);
      appendable.decreaseIndentation();
    } else {
      appendable.append(" /* Skipped initializer because of errors */");
    }
  } else {
    StringConcatenationClient _compilationTemplate = this._jvmTypeExtensions.getCompilationTemplate(it);
    boolean _tripleNotEquals_1 = (_compilationTemplate != null);
    if (_tripleNotEquals_1) {
      final Iterable<Issue> errors_1 = this.getDirectErrorsOrLogicallyContainedErrors(it);
      boolean _isEmpty_1 = IterableExtensions.isEmpty(errors_1);
      if (_isEmpty_1) {
        appendable.append(" = ").increaseIndentation();
        this.appendCompilationTemplate(appendable, it);
        appendable.decreaseIndentation();
      } else {
        appendable.append(" /* Skipped initializer because of errors */");
      }
    } else {
      final XExpression expression = this._iLogicalContainerProvider.getAssociatedExpression(it);
      if (((expression != null) && config.isGenerateExpressions())) {
        boolean _hasErrors = this._errorSafeExtensions.hasErrors(expression);
        if (_hasErrors) {
          appendable.append(" /* Skipped initializer because of errors */");
        } else {
          appendable.append(" = ");
          this.compiler.compileAsJavaExpression(expression, appendable, it.getType());
        }
      }
    }
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:42,代码来源:JvmModelGenerator.java


注:本文中的org.eclipse.xtext.xbase.lib.IterableExtensions.isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。