Java 类org.eclipse.xtext.xbase.lib.CollectionExtensions 实例源码

项目:xtext-extras    文件:ImplicitlyImportedFeatures.java   
protected List<Class<?>> getExtensionClasses() {
    return Lists.<Class<?>> newArrayList(
        ArrayExtensions.class,
        BigDecimalExtensions.class,
        BigIntegerExtensions.class,
        BooleanExtensions.class,
        ByteExtensions.class,
        CharacterExtensions.class,
        CollectionExtensions.class,
        ComparableExtensions.class,
        DoubleExtensions.class,
        FloatExtensions.class,
        FunctionExtensions.class,
        IntegerExtensions.class,
        IterableExtensions.class,
        IteratorExtensions.class,
        ListExtensions.class,
        LongExtensions.class,
        MapExtensions.class,
        ObjectExtensions.class,
        ProcedureExtensions.class,
        ShortExtensions.class,
        StringExtensions.class);
}
项目:xtext-extras    文件:FragmentAdapter.java   
private void generateManifestRt(final LanguageConfig config1, final XpandExecutionContext ctx) {
  ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
  boolean _tripleNotEquals = (_manifest != null);
  if (_tripleNotEquals) {
    final String[] exported = this.fragment.getExportedPackagesRt(config1.getGrammar());
    if ((exported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntime().getManifest().getExportedPackages(), exported);
    }
    final String[] required = this.fragment.getRequiredBundlesRt(config1.getGrammar());
    if ((required != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntime().getManifest().getRequiredBundles(), required);
    }
    final String[] imported = this.fragment.getImportedPackagesRt(config1.getGrammar());
    if ((imported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntime().getManifest().getImportedPackages(), imported);
    }
  }
}
项目:xtext-extras    文件:FragmentAdapter.java   
private void generateManifestUi(final LanguageConfig config1, final XpandExecutionContext ctx) {
  ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest();
  boolean _tripleNotEquals = (_manifest != null);
  if (_tripleNotEquals) {
    final String[] exported = this.fragment.getExportedPackagesUi(config1.getGrammar());
    if ((exported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages(), exported);
    }
    final String[] required = this.fragment.getRequiredBundlesUi(config1.getGrammar());
    if ((required != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles(), required);
    }
    final String[] imported = this.fragment.getImportedPackagesUi(config1.getGrammar());
    if ((imported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getEclipsePlugin().getManifest().getImportedPackages(), imported);
    }
  }
}
项目:xtext-extras    文件:FragmentAdapter.java   
private void generateManifestIde(final LanguageConfig config1, final XpandExecutionContext ctx) {
  if (((this.fragment instanceof IGeneratorFragmentExtension3) && (this.getProjectConfig().getGenericIde().getManifest() != null))) {
    final IGeneratorFragmentExtension3 fr = ((IGeneratorFragmentExtension3) this.fragment);
    final String[] exported = fr.getExportedPackagesIde(config1.getGrammar());
    if ((exported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getGenericIde().getManifest().getExportedPackages(), exported);
    }
    final String[] required = fr.getRequiredBundlesIde(config1.getGrammar());
    if ((required != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getGenericIde().getManifest().getRequiredBundles(), required);
    }
    final String[] imported = fr.getImportedPackagesIde(config1.getGrammar());
    if ((imported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getGenericIde().getManifest().getImportedPackages(), imported);
    }
  }
}
项目:xtext-extras    文件:FragmentAdapter.java   
private void generateManifestTests(final LanguageConfig config1, final XpandExecutionContext ctx) {
  if (((this.fragment instanceof IGeneratorFragmentExtension) && (this.getProjectConfig().getRuntimeTest().getManifest() != null))) {
    final IGeneratorFragmentExtension fr = ((IGeneratorFragmentExtension) this.fragment);
    final String[] exported = fr.getExportedPackagesTests(config1.getGrammar());
    if ((exported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntimeTest().getManifest().getExportedPackages(), exported);
    }
    final String[] required = fr.getRequiredBundlesTests(config1.getGrammar());
    if ((required != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntimeTest().getManifest().getRequiredBundles(), required);
    }
    final String[] imported = fr.getImportedPackagesTests(config1.getGrammar());
    if ((imported != null)) {
      CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntimeTest().getManifest().getImportedPackages(), imported);
    }
  }
}
项目:xtext-core    文件:TypesGeneratorFragment2.java   
@Override
public void generate() {
  if ((this.onlyEnabledIfGrammarIsUsed.get() && (!this.xbaseUsageDetector.inheritsXtype(this.getLanguage().getGrammar())))) {
    return;
  }
  new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IGlobalScopeProvider.class), 
    TypeReference.typeRef("org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider")).contributeTo(this.getLanguage().getRuntimeGenModule());
  GuiceModuleAccess _runtimeGenModule = this.getLanguage().getRuntimeGenModule();
  _runtimeGenModule.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.common.types.DefaultCommonTypesRuntimeModule"));
  new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.PrefixMatcher"), 
    TypeReference.typeRef("org.eclipse.xtext.ui.editor.contentassist.FQNPrefixMatcher")).contributeTo(this.getLanguage().getEclipsePluginGenModule());
  GuiceModuleAccess _eclipsePluginGenModule = this.getLanguage().getEclipsePluginGenModule();
  _eclipsePluginGenModule.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.common.types.ui.DefaultCommonTypesUiModule"));
  ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
  boolean _tripleNotEquals = (_manifest != null);
  if (_tripleNotEquals) {
    CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntime().getManifest().getRequiredBundles(), 
      "org.eclipse.xtext.common.types", 
      "org.objectweb.asm;bundle-version=\"[5.0.1,6.0.0)\";resolution:=optional");
  }
  ManifestAccess _manifest_1 = this.getProjectConfig().getRuntimeTest().getManifest();
  boolean _tripleNotEquals_1 = (_manifest_1 != null);
  if (_tripleNotEquals_1) {
    this.getProjectConfig().getRuntimeTest().getManifest().getRequiredBundles().add(
      "org.objectweb.asm;bundle-version=\"[5.0.1,6.0.0)\";resolution:=optional");
  }
  ManifestAccess _manifest_2 = this.getProjectConfig().getEclipsePlugin().getManifest();
  boolean _tripleNotEquals_2 = (_manifest_2 != null);
  if (_tripleNotEquals_2) {
    this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles().add(
      "org.eclipse.xtext.common.types.ui");
  }
}
项目:mm-dsl    文件:MMDSLGenerator.java   
public String RngColor() {
  Random _random = new Random();
  Random rand = _random;
  ArrayList<String> _arrayList = new ArrayList<String>();
  ArrayList<String> colors = _arrayList;
  CollectionExtensions.<String>addAll(colors, 
    "red", 
    "blue", 
    "green", 
    "yellow", 
    "pink", 
    "orange", 
    "silver", 
    "black", 
    "azure", 
    "aqua", 
    "coral", 
    "aqua", 
    "brown", 
    "gold", 
    "gray", 
    "navy", 
    "violet", 
    "darkblue", 
    "blueviolet", 
    "crimson");
  int colornum = rand.nextInt(19);
  return colors.get(colornum);
}
项目:astahm2t    文件:GeneratorUtils.java   
private void getStates(final IStateMachine m) {
  final Function1<IVertex, Boolean> _function = (IVertex s) -> {
    return Boolean.valueOf((!((s instanceof IPseudostate) || (s instanceof IFinalState))));
  };
  Iterable<IVertex> _filter = IterableExtensions.<IVertex>filter(((Iterable<IVertex>)Conversions.doWrapArray(m.getVertexes())), _function);
  final IState[] substates = ((IState[]) ((IState[])Conversions.unwrapArray(_filter, IState.class)));
  CollectionExtensions.<IState>addAll(this.allStates, substates);
  final Consumer<IState> _function_1 = (IState sub) -> {
    this.getStates(sub);
  };
  ((List<IState>)Conversions.doWrapArray(substates)).forEach(_function_1);
}
项目:astahm2t    文件:GeneratorUtils.java   
private void getStates(final IState state) {
  final Function1<IVertex, Boolean> _function = (IVertex s) -> {
    return Boolean.valueOf((!((s instanceof IPseudostate) || (s instanceof IFinalState))));
  };
  Iterable<IVertex> _filter = IterableExtensions.<IVertex>filter(((Iterable<IVertex>)Conversions.doWrapArray(state.getSubvertexes())), _function);
  final IState[] substates = ((IState[]) ((IState[])Conversions.unwrapArray(_filter, IState.class)));
  CollectionExtensions.<IState>addAll(this.allStates, substates);
  final Consumer<IState> _function_1 = (IState sub) -> {
    this.getStates(sub);
  };
  ((List<IState>)Conversions.doWrapArray(substates)).forEach(_function_1);
}
项目:xtext-extras    文件:StaticImplicitMethodsFeatureForTypeProvider.java   
protected Multimap<Class<?>, Class<?>> simpleComputeExtensionClasses() {
    Multimap<Class<?>, Class<?>> result = ArrayListMultimap.create();
    result.put(String.class, StringExtensions.class);
    result.put(Double.TYPE, DoubleExtensions.class);
    result.put(Float.TYPE, FloatExtensions.class);
    result.put(Long.TYPE, LongExtensions.class);
    result.put(Integer.TYPE, IntegerExtensions.class);
    result.put(Character.TYPE, CharacterExtensions.class);
    result.put(Short.TYPE, ShortExtensions.class);
    result.put(Byte.TYPE, ByteExtensions.class);
    result.put(Boolean.TYPE, BooleanExtensions.class);
    result.put(double[].class, ArrayExtensions.class);
    result.put(float[].class, ArrayExtensions.class);
    result.put(long[].class, ArrayExtensions.class);
    result.put(int[].class, ArrayExtensions.class);
    result.put(char[].class, ArrayExtensions.class);
    result.put(short[].class, ArrayExtensions.class);
    result.put(byte[].class, ArrayExtensions.class);
    result.put(boolean[].class, ArrayExtensions.class);
    result.put(BigInteger.class, BigIntegerExtensions.class);
    result.put(BigDecimal.class, BigDecimalExtensions.class);
    result.put(Comparable.class, ComparableExtensions.class);
    result.put(Object.class, ObjectExtensions.class);
    result.put(List.class, ListExtensions.class);
    result.put(Collection.class, CollectionExtensions.class);
    result.put(Map.class, CollectionExtensions.class);
    result.put(Map.class, MapExtensions.class);
    result.put(Iterable.class, IterableExtensions.class);
    result.put(Iterator.class, IteratorExtensions.class);
    result.put(Functions.Function0.class, FunctionExtensions.class);
    result.put(Functions.Function1.class, FunctionExtensions.class);
    result.put(Functions.Function2.class, FunctionExtensions.class);
    result.put(Functions.Function3.class, FunctionExtensions.class);
    result.put(Functions.Function4.class, FunctionExtensions.class);
    result.put(Functions.Function5.class, FunctionExtensions.class);
    result.put(Functions.Function6.class, FunctionExtensions.class);
    result.put(Procedures.Procedure0.class, ProcedureExtensions.class);
    result.put(Procedures.Procedure1.class, ProcedureExtensions.class);
    result.put(Procedures.Procedure2.class, ProcedureExtensions.class);
    result.put(Procedures.Procedure3.class, ProcedureExtensions.class);
    result.put(Procedures.Procedure4.class, ProcedureExtensions.class);
    result.put(Procedures.Procedure5.class, ProcedureExtensions.class);
    result.put(Procedures.Procedure6.class, ProcedureExtensions.class);
    return result;
}