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


Java ImmutableBiMap.copyOf方法代码示例

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


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

示例1: build

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
GqlInputConverter build() {
  HashBiMap<String, Descriptor> mapping = HashBiMap.create();
  HashBiMap<String, EnumDescriptor> enumMapping = HashBiMap.create(getEnumMap(enumDescriptors));
  LinkedList<Descriptor> loop = new LinkedList<>(descriptors);

  Set<FileDescriptor> fileDescriptorSet = ProtoRegistry.extractDependencies(fileDescriptors);

  for (FileDescriptor fileDescriptor : fileDescriptorSet) {
    loop.addAll(fileDescriptor.getMessageTypes());
    enumMapping.putAll(getEnumMap(fileDescriptor.getEnumTypes()));
  }

  while (!loop.isEmpty()) {
    Descriptor descriptor = loop.pop();
    if (!mapping.containsKey(descriptor.getFullName())) {
      mapping.put(getReferenceName(descriptor), descriptor);
      loop.addAll(descriptor.getNestedTypes());
      enumMapping.putAll(getEnumMap(descriptor.getEnumTypes()));
    }
  }

  return new GqlInputConverter(
      ImmutableBiMap.copyOf(mapping), ImmutableBiMap.copyOf(enumMapping));
}
 
开发者ID:google,项目名称:rejoiner,代码行数:25,代码来源:GqlInputConverter.java

示例2: Support

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
Support(final Expr expr, final String body, final Set<URI> properties,
        final Map<String, String> namespaces) {

    super(null, XPathFunction.CONTEXT, VARIABLES, XPathNavigator.INSTANCE);

    final StringBuilder builder = new StringBuilder();
    for (final String prefix : Ordering.natural().sortedCopy(namespaces.keySet())) {
        final String namespace = namespaces.get(prefix);
        if (!namespace.equals(Data.getNamespaceMap().get(prefix))) {
            builder.append(builder.length() == 0 ? "" : ", ").append(prefix).append(": ")
                    .append("<").append(namespace).append(">");
        }
    }
    final String head = builder.toString();

    this.string = head.isEmpty() ? body : "with " + head + " : " + body;
    this.head = head.isEmpty() ? "" : this.string.substring(5, 5 + head.length());
    this.body = head.isEmpty() ? body : this.string.substring(8 + head.length());
    this.expr = expr;
    this.properties = properties;
    this.namespaces = ImmutableBiMap.copyOf(namespaces);
}
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:23,代码来源:XPath.java

示例3: getMap

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
private static BiMap<String, GraphQLType> getMap(
    List<FileDescriptor> fileDescriptors,
    List<Descriptor> descriptors,
    List<EnumDescriptor> enumDescriptors,
    GraphQLInterfaceType nodeInterface) {
  HashBiMap<String, GraphQLType> mapping = HashBiMap.create(getEnumMap(enumDescriptors));
  LinkedList<Descriptor> loop = new LinkedList<>(descriptors);

  Set<FileDescriptor> fileDescriptorSet = extractDependencies(fileDescriptors);

  for (FileDescriptor fileDescriptor : fileDescriptorSet) {
    loop.addAll(fileDescriptor.getMessageTypes());
    mapping.putAll(getEnumMap(fileDescriptor.getEnumTypes()));
  }

  while (!loop.isEmpty()) {
    Descriptor descriptor = loop.pop();
    if (!mapping.containsKey(descriptor.getFullName())) {
      mapping.put(
          ProtoToGql.getReferenceName(descriptor),
          ProtoToGql.convert(descriptor, nodeInterface));
      GqlInputConverter inputConverter =
          GqlInputConverter.newBuilder().add(descriptor.getFile()).build();
      mapping.put(
          GqlInputConverter.getReferenceName(descriptor),
          inputConverter.getInputType(descriptor));
      loop.addAll(descriptor.getNestedTypes());

      mapping.putAll(getEnumMap(descriptor.getEnumTypes()));
    }
  }
  return ImmutableBiMap.copyOf(mapping);
}
 
开发者ID:google,项目名称:rejoiner,代码行数:34,代码来源:ProtoRegistry.java

示例4: create

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
@Override
protected BiMap<String, String> create(Entry<String, String>[] entries) {
  Map<String, String> builder = Maps.newLinkedHashMap();
  for (Entry<String, String> entry : entries) {
    builder.put(entry.getKey(), entry.getValue());
  }
  return ImmutableBiMap.copyOf(builder);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:9,代码来源:BiMapGenerators.java

示例5: getABFMapper

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
public static ImmutableBiMap<String,String> getABFMapper()    {
    String serviceURL = null;
    ImmutableBiMap<String,String> ABFMAPPER = null;
    try {
        serviceURL = System.getenv("authcode.service.URL");
        if (serviceURL == null)
            serviceURL = System.getProperty("authcode.service.URL","http://localhost:9876/references");
        LOG.info("Initializing ABF Reference with remote service URL: "+ serviceURL);
        Client client = Client.create();
        WebResource webResource = client.resource(serviceURL);
        ClientResponse response = webResource.accept("application/json")
                .get(ClientResponse.class);
        String output = response.getEntity(String.class);
        if (response.getStatus() == 200 && output != null && !output.isEmpty()) {
            Map<String, String> mapResponse = OBJECT_MAPPER.readValue(output, new TypeReference<Map<String, String>>() {});
            ABFMAPPER = ImmutableBiMap.copyOf(Collections.unmodifiableMap(mapResponse));
            LOG.info("Success on getting ABF Reference map from  "+ serviceURL);
        } else {
            ABFMAPPER = ImmutableBiMap.copyOf(Collections.unmodifiableMap(ABFCodeMap.defaultABFMapper()));
        }

    }catch(Exception ex){
        ABFMAPPER = ImmutableBiMap.copyOf(Collections.unmodifiableMap(ABFCodeMap.defaultABFMapper()));
        LOG.warn("ABF Mapper initialization failed");
    }
    return ABFMAPPER;
}
 
开发者ID:tmobile,项目名称:keybiner,代码行数:28,代码来源:ABFCodeMap.java

示例6: getModObjectList

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
public BiMap<ModContainer, Object> getModObjectList()
{
    if (modObjectList == null)
    {
        FMLLog.severe("Detected an attempt by a mod %s to perform game activity during mod construction. This is a serious programming error.", activeContainer);
        return buildModObjectList();
    }
    return ImmutableBiMap.copyOf(modObjectList);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:10,代码来源:LoadController.java

示例7: testGetTokenDefMap_02

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
@Test public void testGetTokenDefMap_02() {
	ITokenDefProvider tokenDefProvider = get(ITokenDefProvider.class);
	ImmutableBiMap<Integer, String> tokens = ImmutableBiMap.copyOf(tokenDefProvider.getTokenDefMap());
	ImmutableBiMap<String,Integer> inverseTokens = tokens.inverse();
	assertTrue("'\n'", inverseTokens.containsKey("'\n'"));
	assertTrue("'\r'", inverseTokens.containsKey("'\r'"));
	assertTrue("RULE_ID", inverseTokens.containsKey("RULE_ID"));
	assertTrue("RULE_ANY_OTHER", inverseTokens.containsKey("RULE_ANY_OTHER"));
	assertTrue("RULE_WS", inverseTokens.containsKey("RULE_WS"));
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:11,代码来源:AbstractBug301935Test.java

示例8: getLocalEndpoint

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
public String getLocalEndpoint() throws ReaperException {
  String cassandraVersion = getCassandraVersion();
  if (versionCompare(cassandraVersion, "2.1.10") >= 0) {
    return ((StorageServiceMBean) ssProxy)
        .getHostIdToEndpoint()
        .get(((StorageServiceMBean) ssProxy).getLocalHostId());
  } else {
    // pre-2.1.10 compatibility
    BiMap<String, String> hostIdBiMap =
        ImmutableBiMap.copyOf(((StorageServiceMBean) ssProxy).getHostIdMap());
    String localHostId = ((StorageServiceMBean) ssProxy).getLocalHostId();
    return hostIdBiMap.inverse().get(localHostId);
  }
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:15,代码来源:JmxProxyImpl.java

示例9: create

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
@Override protected BiMap<String, String> create(Entry<String, String>[] entries) {
  Map<String, String> builder = Maps.newLinkedHashMap();
  for (Entry<String, String> entry : entries) {
    builder.put(entry.getKey(), entry.getValue());
  }
  return ImmutableBiMap.copyOf(builder);
}
 
开发者ID:sander120786,项目名称:guava-libraries,代码行数:8,代码来源:BiMapGenerators.java

示例10: getResult

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
@Override
public Mappings getResult() {
    ImmutableBiMap<JavaType, JavaType> types = ImmutableBiMap.copyOf(this.types);
    ImmutableBiMap.Builder<MethodData, MethodData> methods = ImmutableBiMap.builder();
    ImmutableBiMap.Builder<FieldData, FieldData> fields = ImmutableBiMap.builder();
    this.methods.forEach((originalData, newName) -> methods.put(originalData, originalData
            .mapTypes(original -> types.getOrDefault(original, original))
            .withName(newName)));
    this.fields.forEach((originalData, newName) -> fields.put(originalData, originalData
            .mapTypes(original -> types.getOrDefault(original, original))
            .withName(newName)));
    return ImmutableMappings.create(types, methods.build(), fields.build());
}
 
开发者ID:Techcable,项目名称:SrgLib,代码行数:14,代码来源:CompactSrgMappingsFormat.java

示例11: EnumArg

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
private EnumArg(BiMap<E, String> args, String name) {
    super(name);
    this.args = ImmutableBiMap.copyOf(args);
}
 
开发者ID:kenzierocks,项目名称:HardVox,代码行数:5,代码来源:EnumArg.java

示例12: ofImmutable

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
static <N, E> UndirectedNetworkConnections<N, E> ofImmutable(Map<E, N> incidentEdges) {
  return new UndirectedNetworkConnections<N, E>(ImmutableBiMap.copyOf(incidentEdges));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:4,代码来源:UndirectedNetworkConnections.java

示例13: ofImmutable

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
static <N, E> DirectedNetworkConnections<N, E> ofImmutable(
    Map<E, N> inEdges, Map<E, N> outEdges, int selfLoopCount) {
  return new DirectedNetworkConnections<N, E>(
      ImmutableBiMap.copyOf(inEdges), ImmutableBiMap.copyOf(outEdges), selfLoopCount);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:6,代码来源:DirectedNetworkConnections.java

示例14: ObfuscatedStateMapper

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
protected ObfuscatedStateMapper() {
    LOGGER.info("Using build mapping \"" + ForgeHaxProperties.getMcpMappingUrl() + "\"");

    MCPMappingLoader mcpMappingLoader = null;
    try {
        mcpMappingLoader = new MCPMappingLoader(ForgeHaxProperties.getMcpMappingUrl());
    } catch (Exception e) {
        LOGGER.error(e.getMessage());
        ASMStackLogger.printStackTrace(e);
    }

    LOGGER.info("Mapping data successfully initialize");

    Objects.requireNonNull(mcpMappingLoader, "MCPMappingLoader failed to lookup obfuscation data");

    if(isObfuscated())
        LOGGER.info("initializing ObfuscatedStateMapper WITH obfuscation");
    else
        LOGGER.info("initializing ObfuscatedStateMapper WITHOUT obfuscation");

    this.mcClasses = ImmutableBiMap.copyOf(FastReflectionForge.Fields.FMLDeobfuscatingRemapper_classNameBiMap.get(FMLDeobfuscatingRemapper.INSTANCE));

    this.mcpMethodData = buildMcpTypeData(
            mcpMappingLoader.getCsvMethodData(),
            mcpMappingLoader.getSrgFileData().class2MethodDataSet,
            getConvertedMap(
                    FastReflectionForge.Fields.FMLDeobfuscatingRemapper_rawMethodMaps.get(FMLDeobfuscatingRemapper.INSTANCE),
                    str -> str.split("\\(")[0]
            ),
            ((csvData, data) -> csvData.getMcpName() + data.getSrgDescriptor())
    );
    this.mcpFieldData = buildMcpTypeData(
            mcpMappingLoader.getCsvFieldData(),
            mcpMappingLoader.getSrgFileData().class2FieldDataSet,
            getConvertedMap(
                    FastReflectionForge.Fields.FMLDeobfuscatingRemapper_rawFieldMaps.get(FMLDeobfuscatingRemapper.INSTANCE),
                    str -> str.split(":")[0]
            ),
            ((csvData, data) -> csvData.getMcpName())
    );
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:42,代码来源:ObfuscatedStateMapper.java

示例15: getRenamingMap

import com.google.common.collect.ImmutableBiMap; //导入方法依赖的package包/类
public ImmutableBiMap<String,String> getRenamingMap()
{
    return ImmutableBiMap.copyOf(renamingMap);
}
 
开发者ID:ArticulatedSocialAgentsPlatform,项目名称:HmiCore,代码行数:5,代码来源:RenamingXMLMap.java


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