当前位置: 首页>>代码示例>>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;未经允许,请勿转载。