當前位置: 首頁>>代碼示例>>Java>>正文


Java ImmutableBiMap.of方法代碼示例

本文整理匯總了Java中com.google.common.collect.ImmutableBiMap.of方法的典型用法代碼示例。如果您正苦於以下問題:Java ImmutableBiMap.of方法的具體用法?Java ImmutableBiMap.of怎麽用?Java ImmutableBiMap.of使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.ImmutableBiMap的用法示例。


在下文中一共展示了ImmutableBiMap.of方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createSingleTierStrategy

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
/**
 * Used to create a Single Tier Index Strategy. For example, this would be
 * used to generate a strategy that has Point type spatial data.
 * 
 * @param dimensionDefs
 *            an array of SFC Dimension Definition objects
 * @param sfc
 *            the type of space filling curve (e.g. Hilbert)
 * @return an Index Strategy object with a single tier
 */
static public TieredSFCIndexStrategy createSingleTierStrategy(
		final SFCDimensionDefinition[] dimensionDefs,
		final SFCType sfc ) {
	final SpaceFillingCurve[] orderedSfcs = new SpaceFillingCurve[] {
		SFCFactory.createSpaceFillingCurve(
				dimensionDefs,
				sfc)
	};
	// unwrap SFC dimension definitions
	final NumericDimensionDefinition[] baseDefinitions = new NumericDimensionDefinition[dimensionDefs.length];
	int maxBitsOfPrecision = Integer.MIN_VALUE;
	for (int d = 0; d < baseDefinitions.length; d++) {
		baseDefinitions[d] = dimensionDefs[d].getDimensionDefinition();
		maxBitsOfPrecision = Math.max(
				dimensionDefs[d].getBitsOfPrecision(),
				maxBitsOfPrecision);
	}
	return new TieredSFCIndexStrategy(
			baseDefinitions,
			orderedSfcs,
			ImmutableBiMap.of(
					0,
					(byte) maxBitsOfPrecision));
}
 
開發者ID:locationtech,項目名稱:geowave,代碼行數:35,代碼來源:TieredSFCIndexFactory.java

示例2: getProbability

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
@Test
public void getProbability(){
	Node node = new Node()
		.setScore("ham");

	final
	BiMap<String, Node> entityRegistry = ImmutableBiMap.of("1", node);

	NodeScoreDistribution<Double> classification = new NodeScoreDistribution<Double>(new ValueMap<String, Double>(), node){

		@Override
		public BiMap<String, Node> getEntityRegistry(){
			return entityRegistry;
		}
	};

	classification.put("ham", new DoubleValue(0.75d));
	classification.put("spam", new DoubleValue(0.25d));

	assertEquals(ImmutableSet.of("ham", "spam"), classification.getCategoryValues());

	assertEquals((Double)0.75d, classification.getProbability("ham"));
	assertEquals((Double)0.25d, classification.getProbability("spam"));
}
 
開發者ID:jpmml,項目名稱:jpmml-evaluator,代碼行數:25,代碼來源:NodeScoreDistributionTest.java

示例3: testConstantNameMatchesString

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
public void testConstantNameMatchesString() throws Exception {
  // Special case some of the weird HTTP Header names...
  ImmutableBiMap<String, String> specialCases = ImmutableBiMap.of("ETAG", "ETag",
      "X_WEBKIT_CSP", "X-WebKit-CSP", "X_WEBKIT_CSP_REPORT_ONLY", "X-WebKit-CSP-Report-Only");
  ImmutableSet<String> uppercaseAcronyms = ImmutableSet.of(
      "ID", "DNT", "IP", "MD5", "P3P", "TE", "UID", "URL", "WWW", "XSS");
  assertConstantNameMatchesString(HttpHeaders.class, specialCases, uppercaseAcronyms);
}
 
開發者ID:zugzug90,項目名稱:guava-mock,代碼行數:9,代碼來源:HttpHeadersTest.java

示例4: CustomSlotDefinition

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
private CustomSlotDefinition(@NonNull Vector2i position, String id, boolean persistent, AffectCustomSlotListener affectCustomSlotListener, GUIFeature defaultFeature, Iterable<GUIFeature> additionalFeatures) {
    Preconditions.checkArgument(id != null || !persistent, "The slot ID must be specified, if the slot is supposed to be persistent.");

    this.position = position;
    this.id = id;

    if(defaultFeature == null) {
        this.defaultFeatureId = null;
        this.features = ImmutableBiMap.of();
    } else {
        defaultFeatureId = defaultFeature.getId();
        features = ImmutableBiMap.<String, GUIFeature>builder()
                .put(defaultFeature.getId(), defaultFeature)
                .putAll(Util.removeNull(additionalFeatures)
                        .collect(Collectors.toMap(
                                GUIFeature::getId,
                                Function.identity(),
                                (first, second) -> {
                                    throw new IllegalArgumentException("A CustomSlotDefinition cannot contain two GUIFeatures with the same ID.");
                                }
                        )))
                .build();
    }

    this.persistent = persistent;
    this.affectCustomSlotListener = affectCustomSlotListener != null ? affectCustomSlotListener
            : (customSlot, slotTransaction, affectSlotEvent) -> affectSlotEvent.setCancelled(true);
}
 
開發者ID:Limeth,項目名稱:CustomItemLibrary,代碼行數:29,代碼來源:CustomSlotDefinition.java

示例5: getFieldAliases

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
@Override
public ImmutableBiMap<String, String> getFieldAliases() {
  return ImmutableBiMap.of(
      "TLD", "tldStr",
      "dns", "dnsPaused",
      "escrow", "escrowEnabled",
      "premiumPricing", "premiumPriceAckRequired");
}
 
開發者ID:google,項目名稱:nomulus,代碼行數:9,代碼來源:ListTldsAction.java

示例6: getFieldAliases

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
@Override
public ImmutableBiMap<String, String> getFieldAliases() {
  return ImmutableBiMap.of(
      "billingId", "billingIdentifier",
      "clientId", "clientIdentifier",
      "premiumNames", "blockPremiumNames");
}
 
開發者ID:google,項目名稱:nomulus,代碼行數:8,代碼來源:ListRegistrarsAction.java

示例7: testBlazeStateIsSerializable

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
@Test
public void testBlazeStateIsSerializable() {
  BlazeIdeInterfaceAspectsImpl.State state = new BlazeIdeInterfaceAspectsImpl.State();
  state.fileToTargetMapKey =
      ImmutableBiMap.of(
          new File("fileName"),
          TargetIdeInfo.builder().setLabel(Label.create("//test:test")).build().key);
  state.fileState = ImmutableMap.of();
  state.targetMap =
      new TargetMap(ImmutableMap.of()); // Tested separately in testRuleIdeInfoIsSerializable

  TestUtils.assertIsSerializable(state);
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:14,代碼來源:BlazeIdeInterfaceAspectsImplTest.java

示例8: before

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
@Before
public void before() {
    converter = new QuerySearchConverter() {
        @Override
        protected Search.Builder getBuilder() {
            return new Search.Builder() {
                @Override
                protected List<String> getSupportedSortAttributes() {
                    return ImmutableList.of("test:test", "test:test1_abc");
                }

                @Override
                protected Multimap<String, Operator> getSupportedConditions() {
                    return ImmutableMultimap.of("test:test", Operator.EQ, "test:test1_abc", Operator.EQ);
                }
            };
        }

        @Override
        protected ImmutableBiMap<String, String> getQueryAttributeMap() {
            return ImmutableBiMap.of("test", "test:test", "test1_abc", "test:test1_abc");
        }

        @Override
        protected boolean isDateAttribute(String attribute) {
            return false;
        }
    };
    multivaluedMap = new MultivaluedMapImpl<>();
}
 
開發者ID:projectomakase,項目名稱:omakase,代碼行數:31,代碼來源:QuerySearchConverterTest.java

示例9: testConstantNameMatchesString

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
public void testConstantNameMatchesString() throws Exception {
  // Special case some of the weird HTTP Header names...
  ImmutableBiMap<String, String> specialCases = ImmutableBiMap.of("ETAG", "ETag");
  ImmutableSet<String> uppercaseAcronyms = ImmutableSet.of(
      "ID", "DNT", "IP", "MD5", "P3P", "TE", "UID", "URL", "WWW", "XSS");
  assertConstantNameMatchesString(HttpHeaders.class, specialCases, uppercaseAcronyms);
}
 
開發者ID:sander120786,項目名稱:guava-libraries,代碼行數:8,代碼來源:HttpHeadersTest.java

示例10: createNameSupplier

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
private NameSupplier createNameSupplier(
    RenameStrategy renameStrategy, BiMap<String, String> previousMappings) {
  previousMappings = previousMappings != null ?
      previousMappings :
      ImmutableBiMap.<String, String>of();
  if (renameStrategy == RenameStrategy.STABLE) {
    return new StableNameSupplier();
  } else if (generatePseudoNames) {
    return new PseudoNameSuppier(renameStrategy);
  } else {
    return new ObfuscatedNameSuppier(renameStrategy, previousMappings);
  }
}
 
開發者ID:SpoonLabs,項目名稱:astor,代碼行數:14,代碼來源:ReplaceIdGenerators.java

示例11: testConstantNameMatchesString

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
public void testConstantNameMatchesString() throws Exception {
  // Special case some of the weird HTTP Header names...
  ImmutableBiMap<String, String> specialCases =
      ImmutableBiMap.of(
          "ETAG",
          "ETag",
          "X_WEBKIT_CSP",
          "X-WebKit-CSP",
          "X_WEBKIT_CSP_REPORT_ONLY",
          "X-WebKit-CSP-Report-Only");
  ImmutableSet<String> uppercaseAcronyms =
      ImmutableSet.of(
          "ID", "DNT", "DNS", "HTTP2", "IP", "MD5", "P3P", "TE", "UID", "URL", "WWW", "XSS");
  assertConstantNameMatchesString(HttpHeaders.class, specialCases, uppercaseAcronyms);
}
 
開發者ID:google,項目名稱:guava,代碼行數:16,代碼來源:HttpHeadersTest.java

示例12: createNameSupplier

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
private NameSupplier createNameSupplier(
    RenameStrategy renameStrategy, BiMap<String, String> previousMappings) {
  previousMappings = previousMappings != null ?
      previousMappings :
      ImmutableBiMap.<String, String>of();
  if (renameStrategy == RenameStrategy.STABLE) {
    return new StableNameSupplier();
  } else if (renameStrategy == RenameStrategy.XID) {
    return new XidNameSupplier(this.xidHashFunction);
  } else if (generatePseudoNames) {
    return new PseudoNameSupplier(renameStrategy);
  } else {
    return new ObfuscatedNameSupplier(renameStrategy, previousMappings);
  }
}
 
開發者ID:google,項目名稱:closure-compiler,代碼行數:16,代碼來源:ReplaceIdGenerators.java

示例13: testFilterStrings

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
@Test
public void testFilterStrings() throws IOException {
  FilteredDirectoryCopier copier = EasyMock.createMock(FilteredDirectoryCopier.class);
  Capture<Predicate<Path>> capturedPredicate = new Capture<>();
  copier.copyDirs(EasyMock.<ProjectFilesystem>anyObject(),
      EasyMock.<Map<Path, Path>>anyObject(),
      EasyMock.capture(capturedPredicate));
  EasyMock.replay(copier);

  FilterResourcesStep step = new FilterResourcesStep(
      /* inResDirToOutResDirMap */ ImmutableBiMap.<Path, Path>of(),
      /* filterDrawables */ false,
      /* filterStrings */ true,
      /* whitelistedStringDirs */ ImmutableSet.of(Paths.get("com/whitelisted/res")),
      copier,
      /* targetDensities */ null,
      /* drawableFinder */ null,
      /* imageScaler */ null);

  assertEquals(0, step.execute(TestExecutionContext.newInstance()));
  Predicate<Path> filePredicate = capturedPredicate.getValue();

  assertTrue(filePredicate.apply(Paths.get("com/example/res/drawables/image.png")));
  assertTrue(filePredicate.apply(Paths.get("com/example/res/values/strings.xml")));
  assertTrue(filePredicate.apply(Paths.get("com/whitelisted/res/values-af/strings.xml")));

  assertFalse(filePredicate.apply(Paths.get("com/example/res/values-af/strings.xml")));

  EasyMock.verify(copier);
}
 
開發者ID:saleehk,項目名稱:buck-cutom,代碼行數:31,代碼來源:FilterResourcesStepTest.java

示例14: generateImmutableBimap

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
@Generates private static <K, V> ImmutableBiMap<K, V> generateImmutableBimap(
    K key, V value) {
  return ImmutableBiMap.of(key, value);
}
 
開發者ID:zugzug90,項目名稱:guava-mock,代碼行數:5,代碼來源:FreshValueGenerator.java

示例15: FMLDeobfuscatingRemapper

import com.google.common.collect.ImmutableBiMap; //導入方法依賴的package包/類
private FMLDeobfuscatingRemapper()
{
    classNameBiMap=ImmutableBiMap.of();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:5,代碼來源:FMLDeobfuscatingRemapper.java


注:本文中的com.google.common.collect.ImmutableBiMap.of方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。