/** * @param alias a storage tier alias * @return the storage tier ordinal matching the given alias */ public int getOrdinal(String alias) { return mAliasToOrdinal.get(alias); }
protected static String unwrapType(String typeName) { return MoreObjects.firstNonNull(BOXED_TO_PRIMITIVE_TYPES.get(typeName), typeName); }
/** * Gets the implementation class for the given entity interface class. * * @param clazz the entity interface class * @return the implementation class */ public static Class<? extends GlowEntity> getEntity(Class<? extends Entity> clazz) { if (GlowEntity.class.isAssignableFrom(clazz)) { // implementation class, return self return (Class<? extends GlowEntity>) clazz; } return ENTITIES.get(clazz); }
public static int getHllFieldSizeFromLog2m(int log2m) { Preconditions .checkArgument(LOG2M_TO_SIZE_IN_BYTES.containsKey(log2m), "Log2m: " + log2m + " is not in valid range."); return LOG2M_TO_SIZE_IN_BYTES.get(log2m); }
protected static String wrapType(String typeName) { return MoreObjects.firstNonNull(BOXED_TO_PRIMITIVE_TYPES.inverse().get(typeName), typeName); }
public static Class<? extends GlowEntity> getEntity(EntityType type) { return ENTITIES.get(type.getEntityClass()); }
public static int getLog2mFromHllFieldSize(int hllFieldSize) { Preconditions.checkArgument(LOG2M_TO_SIZE_IN_BYTES.containsValue(hllFieldSize), "HllFieldSize: " + hllFieldSize + " is not in valid range."); return LOG2M_TO_SIZE_IN_BYTES.inverse().get(hllFieldSize); } }
private static String upperToHttpHeaderName( String constantName, ImmutableBiMap<String, String> specialCases, ImmutableSet<String> uppercaseAcronyms) { if (specialCases.containsKey(constantName)) { return specialCases.get(constantName); } List<String> parts = Lists.newArrayList(); for (String part : SPLITTER.split(constantName)) { if (!uppercaseAcronyms.contains(part)) { part = part.charAt(0) + Ascii.toLowerCase(part.substring(1)); } parts.add(part); } return JOINER.join(parts); } }
/** * @param ordinal a storage tier ordinal * @return the storage tier alias matching the given ordinal */ public String getAlias(int ordinal) { return mAliasToOrdinal.inverse().get(interpretOrdinal(ordinal, mAliasToOrdinal.size())); }
@Override public JCLiteral inline(Inliner inliner) { Object value = this.getValue(); switch (getKind()) { case CHAR_LITERAL: // Why do they do it like this? I wish I knew. value = (int) ((Character) value).charValue(); break; case BOOLEAN_LITERAL: value = ((Boolean) value) ? 1 : 0; break; default: // do nothing } return inliner.maker().Literal(LIT_KIND_TAG.get(getKind()), value); }
@Override public JCExpression visitBinary(BinaryTree tree, Void v) { if (UBinary.DEMORGAN.containsKey(tree.getKind())) { JCExpression negLeft = copy((JCExpression) tree.getLeftOperand()); JCExpression negRight = copy((JCExpression) tree.getRightOperand()); return maker.Binary( UBinary.OP_CODES.get(UBinary.DEMORGAN.get(tree.getKind())), negLeft, negRight); } else if (UBinary.NEGATION.containsKey(tree.getKind())) { JCExpression left = (JCExpression) tree.getLeftOperand(); JCExpression right = (JCExpression) tree.getRightOperand(); return maker.Binary( UBinary.OP_CODES.get(UBinary.NEGATION.get(tree.getKind())), left, right); } else { return defaultNegation(tree); } }
@GwtIncompatible // SerializableTester public void testSerialization() { ImmutableBiMap<String, Integer> bimap = ImmutableBiMap.copyOf(ImmutableMap.of("one", 1, "two", 2)); ImmutableBiMap<String, Integer> copy = SerializableTester.reserializeAndAssert(bimap); assertEquals(Integer.valueOf(1), copy.get("one")); assertEquals("one", copy.inverse().get(1)); assertSame(copy, copy.inverse().inverse()); }
@GwtIncompatible // SerializableTester public void testInverseSerialization() { ImmutableBiMap<String, Integer> bimap = ImmutableBiMap.copyOf(ImmutableMap.of(1, "one", 2, "two")).inverse(); ImmutableBiMap<String, Integer> copy = SerializableTester.reserializeAndAssert(bimap); assertEquals(Integer.valueOf(1), copy.get("one")); assertEquals("one", copy.inverse().get(1)); assertSame(copy, copy.inverse().inverse()); } }
@Override public JCBinary inline(Inliner inliner) throws CouldNotResolveImportException { return inliner .maker() .Binary( OP_CODES.get(getKind()), getLeftOperand().inline(inliner), getRightOperand().inline(inliner)); }
@Override public JCAssignOp inline(Inliner inliner) throws CouldNotResolveImportException { return inliner .maker() .Assignop( TAG.get(getKind()), getVariable().inline(inliner), getExpression().inline(inliner)); }
@Override public UExpression negate() { if (NEGATION.containsKey(getKind())) { return UBinary.create(NEGATION.get(getKind()), getLeftOperand(), getRightOperand()); } else if (DEMORGAN.containsKey(getKind())) { return UBinary.create( DEMORGAN.get(getKind()), getLeftOperand().negate(), getRightOperand().negate()); } else { return super.negate(); } } }
BugCheckerInfo check = getAllChecks().get(checkName); if (check == null) { if (errorProneOptions.ignoreUnknownChecks()) {
public static AbiName fromProto(AbiAlias abiAlias) { return checkNotNull( ABI_ALIAS_TO_ABI_NAME_MAP.get(abiAlias), "Unrecognized ABI '%s'.", abiAlias); }
return inliner.maker().Unary(UNARY_OP_CODES.get(getKind()), getExpression().inline(inliner));
public AbiAlias toProto() { return ABI_ALIAS_TO_ABI_NAME_MAP.inverse().get(this); }