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


Java CollectionLiterals.newHashMap方法代码示例

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


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

示例1: computeExportedObjectsMap

import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
protected void computeExportedObjectsMap(final EObject source) {
  final Resource resource = source.eResource();
  final IResourceServiceProvider resourceServiceProvider = this.resourceServiceProviderRegistry.getResourceServiceProvider(resource.getURI());
  if ((resourceServiceProvider != null)) {
    final IResourceDescription resourceDescription = resourceServiceProvider.getResourceDescriptionManager().getResourceDescription(resource);
    this.exportedContainersInCurrentResource = CollectionLiterals.<EObject, URI>newHashMap();
    Iterable<IEObjectDescription> _exportedObjects = resourceDescription.getExportedObjects();
    for (final IEObjectDescription description : _exportedObjects) {
      {
        EObject instance = description.getEObjectOrProxy();
        boolean _eIsProxy = instance.eIsProxy();
        if (_eIsProxy) {
          instance = resource.getEObject(description.getEObjectURI().fragment());
        }
        this.exportedContainersInCurrentResource.put(instance, description.getEObjectURI());
      }
    }
  } else {
    this.exportedContainersInCurrentResource = CollectionLiterals.<EObject, URI>emptyMap();
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:22,代码来源:ReferenceAcceptor.java

示例2: findEPackagesInGenPackages

import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
private Map<String, EPackage> findEPackagesInGenPackages(final Collection<String> packageNsURIs, final ResourceSet resourceSet) {
  final HashMap<String, EPackage> result = CollectionLiterals.<String, EPackage>newHashMap();
  for (final String nsURI : packageNsURIs) {
    {
      final Resource resource = GenModelUtil2.getGenModelResource(null, nsURI, resourceSet);
      if ((resource != null)) {
        final GenModel loadedGenModel = IterableExtensions.<GenModel>head(Iterables.<GenModel>filter(resource.getContents(), GenModel.class));
        if ((loadedGenModel != null)) {
          final GenPackage genPackage = this.findGenPackageByNsURI(loadedGenModel, nsURI);
          result.put(nsURI, genPackage.getEcorePackage());
        }
      }
    }
  }
  return result;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:17,代码来源:EMFGeneratorFragment2.java

示例3: getAllAmbiguousTransitionsBySyntax

import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public List<EqualAmbiguousTransitions> getAllAmbiguousTransitionsBySyntax() {
  if ((this.ambiguousTransitions != null)) {
    return this.ambiguousTransitions;
  }
  final Map<GrammarAlias.AbstractElementAlias, EqualAmbiguousTransitions> result = CollectionLiterals.<GrammarAlias.AbstractElementAlias, EqualAmbiguousTransitions>newHashMap();
  Set<ISyntacticSequencerPDAProvider.ISynTransition> _allAmbiguousTransitions = this.getAllAmbiguousTransitions();
  for (final ISyntacticSequencerPDAProvider.ISynTransition transition : _allAmbiguousTransitions) {
    List<GrammarAlias.AbstractElementAlias> _ambiguousSyntaxes = transition.getAmbiguousSyntaxes();
    for (final GrammarAlias.AbstractElementAlias syntax : _ambiguousSyntaxes) {
      {
        EqualAmbiguousTransitions list = result.get(syntax);
        if ((list == null)) {
          String _elementAliasToIdentifier = this.elementAliasToIdentifier(syntax);
          EqualAmbiguousTransitions _equalAmbiguousTransitions = new EqualAmbiguousTransitions(_elementAliasToIdentifier, syntax);
          list = _equalAmbiguousTransitions;
          result.put(syntax, list);
        }
        list.getTransitions().add(transition);
      }
    }
  }
  this.ambiguousTransitions = CollectionLiterals.<EqualAmbiguousTransitions>newArrayList(((EqualAmbiguousTransitions[])Conversions.unwrapArray(result.values(), EqualAmbiguousTransitions.class)));
  ListExtensions.<EqualAmbiguousTransitions>sortInplace(this.ambiguousTransitions);
  return this.ambiguousTransitions;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:26,代码来源:SyntacticSequencerExtensions.java

示例4: getDiagnostics

import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
protected Map<String, List<Diagnostic>> getDiagnostics() {
  try {
    final Function1<CancelIndicator, HashMap<String, List<Diagnostic>>> _function = (CancelIndicator it) -> {
      final HashMap<String, List<Diagnostic>> result = CollectionLiterals.<String, List<Diagnostic>>newHashMap();
      final Function1<Pair<String, Object>, Object> _function_1 = (Pair<String, Object> it_1) -> {
        return it_1.getValue();
      };
      Iterable<PublishDiagnosticsParams> _filter = Iterables.<PublishDiagnosticsParams>filter(ListExtensions.<Pair<String, Object>, Object>map(this.notifications, _function_1), PublishDiagnosticsParams.class);
      for (final PublishDiagnosticsParams diagnostic : _filter) {
        result.put(diagnostic.getUri(), diagnostic.getDiagnostics());
      }
      return result;
    };
    return this.languageServer.getRequestManager().<HashMap<String, List<Diagnostic>>>runRead(_function).get();
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:19,代码来源:AbstractLanguageServerTest.java

示例5: supportedMethods

import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
@Override
public Map<String, JsonRpcMethod> supportedMethods() {
  final HashMap<String, JsonRpcMethod> result = CollectionLiterals.<String, JsonRpcMethod>newHashMap();
  result.putAll(ServiceEndpoints.getSupportedMethods(this.getClass()));
  result.putAll(ServiceEndpoints.getSupportedMethods(TestLangLSPExtension.CustomClient.class));
  return result;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:8,代码来源:TestLangLSPExtension.java

示例6: findAllUsedEPackages

import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
private Map<String, EPackage> findAllUsedEPackages(final List<EPackage> generatedPackages) {
  final HashMap<String, EPackage> result = CollectionLiterals.<String, EPackage>newHashMap();
  final TreeIterator<EObject> packageContentIterator = EcoreUtil.<EObject>getAllContents(generatedPackages);
  while (packageContentIterator.hasNext()) {
    {
      final EObject current = packageContentIterator.next();
      EList<EObject> _eCrossReferences = current.eCrossReferences();
      for (final EObject referenced : _eCrossReferences) {
        {
          boolean _eIsProxy = referenced.eIsProxy();
          if (_eIsProxy) {
            throw new RuntimeException(((("Unresolved proxy: " + referenced) + " in ") + current));
          }
          if ((referenced instanceof EClassifier)) {
            final EPackage referencedPackage = ((EClassifier)referenced).getEPackage();
            boolean _contains = generatedPackages.contains(referencedPackage);
            boolean _not = (!_contains);
            if (_not) {
              result.put(referencedPackage.getNsURI(), referencedPackage);
            }
          }
        }
      }
    }
  }
  return result;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:28,代码来源:EMFGeneratorFragment2.java

示例7: createENamedElementMapping

import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
private Map<EObject, EObject> createENamedElementMapping(final Map<String, EPackage> usedEPackages, final Map<String, EPackage> loadedEPackages) {
  final HashMap<EObject, EObject> result = CollectionLiterals.<EObject, EObject>newHashMap();
  Set<Map.Entry<String, EPackage>> _entrySet = usedEPackages.entrySet();
  for (final Map.Entry<String, EPackage> entry : _entrySet) {
    this.putMappingData(result, entry.getValue(), loadedEPackages.get(entry.getKey()));
  }
  return result;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:9,代码来源:EMFGeneratorFragment2.java

示例8: saveResource

import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
private void saveResource(final Resource resource) {
  try {
    final HashMap<String, Object> saveOptions = CollectionLiterals.<String, Object>newHashMap();
    saveOptions.put(XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.AbsoluteCrossBundleAware() {
      @Override
      public URI deresolve(final URI uri) {
        boolean _isPlatform = uri.isPlatform();
        boolean _not = (!_isPlatform);
        if (_not) {
          Set<Map.Entry<String, URI>> _entrySet = EcorePlugin.getPlatformResourceMap().entrySet();
          for (final Map.Entry<String, URI> entry : _entrySet) {
            {
              String _key = entry.getKey();
              String _plus = ("platform:/resource/" + _key);
              String _plus_1 = (_plus + "/");
              final URI newPrefix = URI.createURI(_plus_1);
              final URI uri2 = uri.replacePrefix(entry.getValue(), newPrefix);
              if ((uri2 != null)) {
                return super.deresolve(uri2);
              }
            }
          }
        }
        return super.deresolve(uri);
      }
    });
    saveOptions.put(Resource.OPTION_LINE_DELIMITER, this.codeConfig.getLineDelimiter());
    resource.save(saveOptions);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:33,代码来源:EMFGeneratorFragment2.java

示例9: NamedSerializationContextProvider

import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public NamedSerializationContextProvider(final Grammar grammar) {
  final Function1<Pair<Integer, ParserRule>, Pair<ParserRule, Integer>> _function = (Pair<Integer, ParserRule> it) -> {
    ParserRule _value = it.getValue();
    Integer _key = it.getKey();
    return Pair.<ParserRule, Integer>of(_value, _key);
  };
  this.rules = CollectionLiterals.<ParserRule, Integer>newHashMap(((Pair<? extends ParserRule, ? extends Integer>[])Conversions.unwrapArray(IterableExtensions.<Pair<Integer, ParserRule>, Pair<ParserRule, Integer>>map(IterableExtensions.<ParserRule>indexed(GrammarUtil.allParserRules(grammar)), _function), Pair.class)));
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:9,代码来源:NamedSerializationContextProvider.java

示例10: installFull

import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public void installFull(final Resource resource) {
  boolean _isInfoFile = this.isInfoFile(resource);
  if (_isInfoFile) {
    return;
  }
  final CompilationUnit compilationUnit = this.getCompilationUnit(resource);
  final ClassLoader classLoader = this.getClassLoader(resource);
  final IResourceDescriptions data = this.resourceDescriptionsProvider.getResourceDescriptions(resource.getResourceSet());
  if ((data == null)) {
    throw new IllegalStateException("no index installed");
  }
  final IndexAwareNameEnvironment nameEnv = new IndexAwareNameEnvironment(resource, classLoader, data, this.stubGenerator);
  IErrorHandlingPolicy _proceedWithAllProblems = DefaultErrorHandlingPolicies.proceedWithAllProblems();
  CompilerOptions _compilerOptions = this.getCompilerOptions(resource);
  final ICompilerRequestor _function = (CompilationResult it) -> {
    boolean _equals = Arrays.equals(it.fileName, compilationUnit.fileName);
    if (_equals) {
      final HashMap<String, byte[]> map = CollectionLiterals.<String, byte[]>newHashMap();
      List<String> topLevelTypes = CollectionLiterals.<String>newArrayList();
      ClassFile[] _classFiles = it.getClassFiles();
      for (final ClassFile cf : _classFiles) {
        {
          final Function1<char[], String> _function_1 = (char[] it_1) -> {
            return String.valueOf(it_1);
          };
          final String className = IterableExtensions.join(ListExtensions.<char[], String>map(((List<char[]>)Conversions.doWrapArray(cf.getCompoundName())), _function_1), ".");
          map.put(className, cf.getBytes());
          if ((!cf.isNestedType)) {
            topLevelTypes.add(className);
          }
        }
      }
      final InMemoryClassLoader inMemClassLoader = new InMemoryClassLoader(map, classLoader);
      for (final String topLevel : topLevelTypes) {
        try {
          BinaryClass _binaryClass = new BinaryClass(topLevel, inMemClassLoader);
          ClassFileBytesAccess _classFileBytesAccess = new ClassFileBytesAccess();
          final JvmDeclaredTypeBuilder builder = new JvmDeclaredTypeBuilder(_binaryClass, _classFileBytesAccess, inMemClassLoader);
          final JvmDeclaredType type = builder.buildType();
          EList<EObject> _contents = resource.getContents();
          _contents.add(type);
        } catch (final Throwable _t) {
          if (_t instanceof Throwable) {
            final Throwable t = (Throwable)_t;
            throw new IllegalStateException((("could not load type \'" + topLevel) + "\'"), t);
          } else {
            throw Exceptions.sneakyThrow(_t);
          }
        }
      }
    }
  };
  DefaultProblemFactory _defaultProblemFactory = new DefaultProblemFactory();
  final org.eclipse.jdt.internal.compiler.Compiler compiler = new org.eclipse.jdt.internal.compiler.Compiler(nameEnv, _proceedWithAllProblems, _compilerOptions, _function, _defaultProblemFactory);
  compiler.compile(new ICompilationUnit[] { compilationUnit });
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:57,代码来源:JavaDerivedStateComputer.java

示例11: Source2GeneratedMapping

import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public Source2GeneratedMapping() {
  this(HashMultimap.<URI, URI>create(), HashMultimap.<URI, URI>create(), CollectionLiterals.<URI, String>newHashMap());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:Source2GeneratedMapping.java

示例12: writeGrammar

import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
protected void writeGrammar() {
  final Wrapper<Boolean> isSaving = Wrapper.<Boolean>wrap(Boolean.valueOf(false));
  final ResourceSet cloneInto = new ResourceSetImpl();
  Map<String, Object> _extensionToFactoryMap = cloneInto.getResourceFactoryRegistry().getExtensionToFactoryMap();
  FragmentFakingEcoreResource.FactoryImpl _factoryImpl = new FragmentFakingEcoreResource.FactoryImpl(isSaving);
  _extensionToFactoryMap.put(
    FragmentFakingEcoreResource.FactoryImpl.ECORE_SUFFIX, _factoryImpl);
  final ResourceSet resourceSet = EcoreUtil2.<ResourceSet>clone(cloneInto, this.getLanguage().getGrammar().eResource().getResourceSet());
  EObject _head = IterableExtensions.<EObject>head(resourceSet.getResource(this.getLanguage().getGrammar().eResource().getURI(), true).getContents());
  final Grammar copy = ((Grammar) _head);
  String _xifexpression = null;
  if ((this.xmlVersion == null)) {
    _xifexpression = GrammarUtil.getClasspathRelativePathToBinGrammar(copy);
  } else {
    String _xblockexpression = null;
    {
      String _simpleName = GrammarAccessFragment2.class.getSimpleName();
      String _plus = ("The property \'xmlVersion\' has been specified for this " + _simpleName);
      String _plus_1 = (_plus + ". Therefore, the grammar is persisted as XMI and not as binary. This can be a performance drawback.");
      GrammarAccessFragment2.LOG.warn(_plus_1);
      _xblockexpression = GrammarUtil.getClasspathRelativePathToXmi(copy);
    }
    _xifexpression = _xblockexpression;
  }
  final String path = _xifexpression;
  final URI uri = this.getProjectConfig().getRuntime().getSrcGen().getURI(path);
  final Resource resource = resourceSet.createResource(uri, ContentHandler.UNSPECIFIED_CONTENT_TYPE);
  HashSet<Grammar> _hashSet = new HashSet<Grammar>();
  this.addAllGrammarsToResource(resource, copy, _hashSet);
  isSaving.set(Boolean.valueOf(true));
  final Map<String, Object> saveOptions = CollectionLiterals.<String, Object>newHashMap();
  if ((resource instanceof XMLResource)) {
    String _elvis = null;
    if (this.xmlVersion != null) {
      _elvis = this.xmlVersion;
    } else {
      _elvis = "1.0";
    }
    ((XMLResource)resource).setXMLVersion(_elvis);
  } else {
    if ((resource instanceof BinaryResourceImpl)) {
      saveOptions.put(BinaryResourceImpl.OPTION_VERSION, BinaryResourceImpl.BinaryIO.Version.VERSION_1_1);
      saveOptions.put(BinaryResourceImpl.OPTION_STYLE_DATA_CONVERTER, Boolean.valueOf(true));
    }
  }
  try {
    resource.save(saveOptions);
  } catch (final Throwable _t) {
    if (_t instanceof IOException) {
      final IOException e = (IOException)_t;
      GrammarAccessFragment2.LOG.error(e.getMessage(), e);
    } else {
      throw Exceptions.sneakyThrow(_t);
    }
  } finally {
    isSaving.set(Boolean.valueOf(false));
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:59,代码来源:GrammarAccessFragment2.java

示例13: getNamedContexts

import org.eclipse.xtext.xbase.lib.CollectionLiterals; //导入方法依赖的package包/类
public <T extends Object> List<NamedSerializationContexts<T>> getNamedContexts(final SerializationContextMap<T> map) {
  final ArrayList<NamedSerializationContexts<T>> result = CollectionLiterals.<NamedSerializationContexts<T>>newArrayList();
  final HashMap<String, Integer> names = CollectionLiterals.<String, Integer>newHashMap();
  List<SerializationContextMap.Entry<T>> _values = map.values();
  for (final SerializationContextMap.Entry<T> e : _values) {
    Set<EClass> _types = e.getTypes();
    for (final EClass t : _types) {
      {
        final List<ISerializationContext> ctx = e.getContexts(t);
        String _xifexpression = null;
        if ((t == null)) {
          _xifexpression = "";
        } else {
          _xifexpression = t.getName();
        }
        String _plus = (_xifexpression + "_");
        String _significantGrammarElement = this.getSignificantGrammarElement(ctx);
        final String name = (_plus + _significantGrammarElement);
        final Integer dup = names.get(name);
        String _xifexpression_1 = null;
        if ((dup == null)) {
          String _xblockexpression = null;
          {
            names.put(name, Integer.valueOf(1));
            _xblockexpression = name;
          }
          _xifexpression_1 = _xblockexpression;
        } else {
          String _xblockexpression_1 = null;
          {
            names.put(name, Integer.valueOf(((dup).intValue() + 1)));
            _xblockexpression_1 = ((name + "_") + dup);
          }
          _xifexpression_1 = _xblockexpression_1;
        }
        final String unique = _xifexpression_1;
        T _value = e.getValue();
        NamedSerializationContexts<T> _namedSerializationContexts = new NamedSerializationContexts<T>(unique, t, ctx, _value);
        result.add(_namedSerializationContexts);
      }
    }
  }
  return result;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:45,代码来源:NamedSerializationContextProvider.java


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