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


Java IterableExtensions.filter方法代码示例

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


在下文中一共展示了IterableExtensions.filter方法的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: getFiles

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public Iterable<? extends AbstractFile> getFiles() {
  ArrayList<AbstractFile> _xblockexpression = null;
  {
    final ArrayList<AbstractFile> files = CollectionLiterals.<AbstractFile>newArrayList();
    Iterable<? extends AbstractFile> _files = super.getFiles();
    Iterables.<AbstractFile>addAll(files, _files);
    boolean _isInlined = this.getTestProject().isInlined();
    if (_isInlined) {
      final Function1<AbstractFile, Boolean> _function = (AbstractFile fileFromTestProject) -> {
        final Function1<AbstractFile, Boolean> _function_1 = (AbstractFile it) -> {
          String _relativePath = it.getRelativePath();
          String _relativePath_1 = fileFromTestProject.getRelativePath();
          return Boolean.valueOf(Objects.equal(_relativePath, _relativePath_1));
        };
        boolean _exists = IterableExtensions.<AbstractFile>exists(files, _function_1);
        return Boolean.valueOf((!_exists));
      };
      Iterable<? extends AbstractFile> _filter = IterableExtensions.filter(this.getTestProject().getFiles(), _function);
      Iterables.<AbstractFile>addAll(files, _filter);
    }
    _xblockexpression = files;
  }
  return _xblockexpression;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:26,代码来源:TestedProjectDescriptor.java

示例3: findProjects

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public void findProjects(final WorkspaceConfig workspaceConfig, final URI uri) {
  if ((uri == null)) {
    return;
  }
  String _fileString = uri.toFileString();
  final File baseFile = new File(_fileString);
  boolean _isDirectory = baseFile.isDirectory();
  boolean _not = (!_isDirectory);
  if (_not) {
    return;
  }
  final Function1<File, Boolean> _function = (File it) -> {
    return Boolean.valueOf(it.isDirectory());
  };
  Iterable<File> _filter = IterableExtensions.<File>filter(((Iterable<File>)Conversions.doWrapArray(baseFile.listFiles())), _function);
  for (final File file : _filter) {
    {
      final FileProjectConfig project = new FileProjectConfig(file, workspaceConfig);
      project.addSourceFolder(".");
      workspaceConfig.addProject(project);
    }
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:25,代码来源:MultiProjectWorkspaceConfigFactory.java

示例4: subClassAlternatives

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public String subClassAlternatives(final EClass eClazz) {
  String _xblockexpression = null;
  {
    ArrayList<EClass> _newArrayList = CollectionLiterals.<EClass>newArrayList(eClazz);
    Iterable<EClass> _subClasses = Ecore2XtextExtensions.subClasses(eClazz);
    Iterable<EClass> list = Iterables.<EClass>concat(_newArrayList, _subClasses);
    final Function1<EClass, Boolean> _function = (EClass c) -> {
      return Boolean.valueOf(Ecore2XtextExtensions.needsConcreteRule(c));
    };
    list = IterableExtensions.<EClass>filter(list, _function);
    final Function1<EClass, String> _function_1 = (EClass it) -> {
      return Ecore2XtextExtensions.concreteRuleName(it);
    };
    _xblockexpression = IterableExtensions.join(IterableExtensions.<EClass, String>map(list, _function_1), " | ");
  }
  return _xblockexpression;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:18,代码来源:Ecore2XtextGrammarCreator.java

示例5: upTo

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
private <T extends Object> Iterable<T> upTo(final Iterable<T> iter, final Object element) {
  abstract class __AbstractCompletePrefixProviderTest_1 implements Function1<T, Boolean> {
    boolean found;
  }
  
  __AbstractCompletePrefixProviderTest_1 ___AbstractCompletePrefixProviderTest_1 = new __AbstractCompletePrefixProviderTest_1() {
    {
      found = false;
    }
    @Override
    public Boolean apply(final T t) {
      if (this.found) {
        return Boolean.valueOf(false);
      }
      try {
        return Boolean.valueOf(true);
      } finally {
        boolean _equals = Objects.equal(t, element);
        this.found = _equals;
      }
    }
  };
  return IterableExtensions.<T>filter(iter, ___AbstractCompletePrefixProviderTest_1);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:25,代码来源:AbstractCompletePrefixProviderTest.java

示例6: checkConfiguration

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public void checkConfiguration(final Issues issues) {
  super.checkConfiguration(issues);
  boolean _isSet = this.framework.isSet();
  boolean _not = (!_isSet);
  if (_not) {
    issues.addError("The property \'framework\' is required.");
  }
  final Function1<String, Boolean> _function = (String it) -> {
    return Boolean.valueOf(this.suppressedPatterns.contains(it));
  };
  Iterable<String> _filter = IterableExtensions.<String>filter(this.enabledPatterns, _function);
  for (final String pattern : _filter) {
    issues.addError((("The pattern \'" + pattern) + "\' cannot be enabled and suppressed."));
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:17,代码来源:WebIntegrationFragment.java

示例7: getEObjectElements

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
protected Iterable<AbstractElement> getEObjectElements(final AbstractRule rule) {
  final Function1<AbstractElement, Boolean> _function = (AbstractElement element) -> {
    boolean _switchResult = false;
    boolean _matched = false;
    if (element instanceof Action) {
      _matched=true;
    }
    if (!_matched) {
      if (element instanceof RuleCall) {
        boolean _isEObjectRuleCall = GrammarUtil.isEObjectRuleCall(element);
        if (_isEObjectRuleCall) {
          _matched=true;
        }
      }
    }
    if (_matched) {
      _switchResult = true;
    }
    if (!_matched) {
      _switchResult = false;
    }
    return Boolean.valueOf(_switchResult);
  };
  return IterableExtensions.<AbstractElement>filter(EcoreUtil2.<AbstractElement>eAllOfType(rule, AbstractElement.class), _function);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:26,代码来源:IdeaPluginGenerator.java

示例8: getOwnedMembers

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<N4MemberDeclaration> getOwnedMembers() {
	final Function1<N4MemberDeclaration, Boolean> _function = new Function1<N4MemberDeclaration, Boolean>() {
		public Boolean apply(final N4MemberDeclaration it) {
			boolean _isCallableConstructor = it.isCallableConstructor();
			return Boolean.valueOf((!_isCallableConstructor));
		}
	};
	final Iterable<N4MemberDeclaration> methods = IterableExtensions.<N4MemberDeclaration>filter(Iterables.<N4MemberDeclaration>filter(this.getOwnedMembersRaw(), N4MemberDeclaration.class), _function);
	List<N4MemberDeclaration> _list = IterableExtensions.<N4MemberDeclaration>toList(methods);
	return new BasicEList<N4MemberDeclaration>(_list);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:17,代码来源:N4ClassifierDeclarationImpl.java

示例9: getOwnedMethods

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<N4MethodDeclaration> getOwnedMethods() {
	final Function1<N4MethodDeclaration, Boolean> _function = new Function1<N4MethodDeclaration, Boolean>() {
		public Boolean apply(final N4MethodDeclaration it) {
			return Boolean.valueOf(((!it.isConstructor()) && (!it.isCallableConstructor())));
		}
	};
	final Iterable<N4MethodDeclaration> methods = IterableExtensions.<N4MethodDeclaration>filter(Iterables.<N4MethodDeclaration>filter(this.getOwnedMembersRaw(), N4MethodDeclaration.class), _function);
	List<N4MethodDeclaration> _list = IterableExtensions.<N4MethodDeclaration>toList(methods);
	return new BasicEList<N4MethodDeclaration>(_list);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:16,代码来源:N4ClassifierDeclarationImpl.java

示例10: 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

示例11: _getMembersToBeCompiled

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
protected Iterable<JvmMember> _getMembersToBeCompiled(final JvmGenericType it) {
  Iterable<JvmMember> _xifexpression = null;
  boolean _isAnonymous = it.isAnonymous();
  if (_isAnonymous) {
    final Function1<JvmMember, Boolean> _function = (JvmMember it_1) -> {
      return Boolean.valueOf((!(it_1 instanceof JvmConstructor)));
    };
    _xifexpression = IterableExtensions.<JvmMember>filter(it.getMembers(), _function);
  } else {
    _xifexpression = this._getMembersToBeCompiled(((JvmDeclaredType) it));
  }
  return _xifexpression;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:14,代码来源:JvmModelGenerator.java

示例12: nodesForKeyword

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public Iterable<ILeafNode> nodesForKeyword(final EObject obj, final String kw) {
  Iterable<ILeafNode> _xblockexpression = null;
  {
    final ICompositeNode node = NodeModelUtils.findActualNodeFor(obj);
    final Function1<ILeafNode, Boolean> _function = (ILeafNode it) -> {
      return Boolean.valueOf(((Objects.equal(it.getSemanticElement(), obj) && (it.getGrammarElement() instanceof Keyword)) && Objects.equal(it.getText(), kw)));
    };
    _xblockexpression = IterableExtensions.<ILeafNode>filter(Iterables.<ILeafNode>filter(node.getAsTreeIterable(), ILeafNode.class), _function);
  }
  return _xblockexpression;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:12,代码来源:NodeModelAccess.java

示例13: getAllFeatures

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public Iterable<JvmFeature> getAllFeatures(final Resource resource, final JvmDeclaredType importedType, final boolean static_, final boolean extension, final String memberName) {
  Iterable<JvmFeature> _xblockexpression = null;
  {
    if (((!static_) || (importedType == null))) {
      return CollectionLiterals.<JvmFeature>emptyList();
    }
    final IVisibilityHelper visibilityHelper = this.getVisibilityHelper(resource);
    final IResolvedFeatures resolvedFeatures = this._provider.getResolvedFeatures(importedType);
    final Function1<JvmFeature, Boolean> _function = (JvmFeature feature) -> {
      return Boolean.valueOf((feature.isStatic() && visibilityHelper.isVisible(feature)));
    };
    _xblockexpression = IterableExtensions.<JvmFeature>filter(resolvedFeatures.getAllFeatures(memberName), _function);
  }
  return _xblockexpression;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:16,代码来源:StaticallyImportedMemberProvider.java

示例14: compile

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
@Override
public CompilationResult compile(Iterable<String> sourceRoots, File outputClassDirectory) {
	Iterable<String> validSourceRoots = IterableExtensions.filter(sourceRoots, new EmptyOrMissingFilter());
	if (!containsJavaFiles(validSourceRoots)) {
		return CompilationResult.SKIPPED;
	}
	List<String> commandLine = Lists.newArrayList();
	if (configuration.isVerbose()) {
		commandLine.add("-verbose");
	}
	if (classPath != null) {
		Iterable<String> validClasspath = IterableExtensions.filter(classPath, new EmptyOrMissingFilter());
		if (validClasspath.iterator().hasNext()) {
			commandLine.add("-cp \"" + concat(File.pathSeparator, Lists.newArrayList(validClasspath)) + "\"");
		}
	}
	commandLine.add("-d \"" + outputClassDirectory.toString() + "\"");
	commandLine.add("-source " + configuration.getSourceLevel());
	commandLine.add("-target " + configuration.getTargetLevel());
	commandLine.add("-proceedOnError");
	for (String src : validSourceRoots) {
		commandLine.add("\"" + src + "\"");
	}
	String cmdLine = concat(" ", commandLine);
	debugLog("invoke batch compiler with '" + cmdLine + "'");
	boolean result = BatchCompiler.compile(cmdLine, new PrintWriter(getOutputWriter()), new PrintWriter(
			getErrorWriter()), null);
	return result ? CompilationResult.SUCCEEDED : CompilationResult.FAILED;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:30,代码来源:EclipseJavaCompiler.java

示例15: allCrossReferences

import org.eclipse.xtext.xbase.lib.IterableExtensions; //导入方法依赖的package包/类
public static Iterable<EReference> allCrossReferences(final EClass it) {
  final Function1<EReference, Boolean> _function = (EReference f) -> {
    boolean _isContainment = f.isContainment();
    return Boolean.valueOf((!_isContainment));
  };
  return IterableExtensions.<EReference>filter(Iterables.<EReference>filter(Ecore2XtextExtensions.inlinedFeatures(it), EReference.class), _function);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:8,代码来源:Ecore2XtextExtensions.java


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