當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。