protected static boolean isPrimitiveWrappedType(String name) { return BOXED_TO_PRIMITIVE_TYPES.containsKey(name); }
public static UBinary create(Kind binaryOp, UExpression lhs, UExpression rhs) { checkArgument( OP_CODES.containsKey(binaryOp), "%s is not a supported binary operation", binaryOp); return new AutoValue_UBinary(binaryOp, lhs, rhs); }
public static UAssignOp create(UExpression variable, Kind operator, UExpression expression) { checkArgument( TAG.containsKey(operator), "Tree kind %s does not represent a compound assignment operator", operator); return new AutoValue_UAssignOp(variable, operator, expression); }
public static UUnary create(Kind unaryOp, UExpression expression) { checkArgument( UNARY_OP_CODES.containsKey(unaryOp), "%s is not a recognized unary operation", unaryOp); return new AutoValue_UUnary(unaryOp, expression); }
public static ULiteral create(Kind kind, Object value) { checkArgument(LIT_KIND_TAG.containsKey(kind), "%s is not a literal kind", kind); return new AutoValue_ULiteral(kind, value); }
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); }
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); } }
@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(); } } }
@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); } }
public static String javaToDexName(String javaName) { if (javaName.charAt(0) == '[') { return javaName.replace('.', '/'); } if (primitiveMap.containsKey(javaName)) { return primitiveMap.get(javaName); } return 'L' + javaName.replace('.', '/') + ';'; }
public static UBinary create(Kind binaryOp, UExpression lhs, UExpression rhs) { checkArgument( OP_CODES.containsKey(binaryOp), "%s is not a supported binary operation", binaryOp); return new AutoValue_UBinary(binaryOp, lhs, rhs); }
public static Class<?> boxedType(Class<?> type) { if (PRIMITIVE_TO_BOXED.containsKey(type)) return PRIMITIVE_TO_BOXED.get(type); return type; }
public static UUnary create(Kind unaryOp, UExpression expression) { checkArgument( UNARY_OP_CODES.containsKey(unaryOp), "%s is not a recognized unary operation", unaryOp); return new AutoValue_UUnary(unaryOp, expression); }
public Duration(String duration) { Matcher matcher = REGEXP.matcher(duration); checkArgument(matcher.matches(), "Invalid duration %s", duration); long value=Long.valueOf(matcher.group(1)); TimeUnit timeUnit=STRING_UNITS.get(matcher.group(2)); checkArgument(timeUnit != null, "timeUnit is null"); checkArgument(UNITS.containsKey(timeUnit), "Invalid unit %s", timeUnit); this.value = value; this.timeUnit = timeUnit; }
public static Class<?> boxedType(Class<?> type) { if (PRIMITIVE_TO_BOXED.containsKey(type)) return PRIMITIVE_TO_BOXED.get(type); return type; }
public static String dexToJavaName(String dexName) { if (dexName.charAt(0) == '[') { return dexName.replace('/', '.'); } if (primitiveMap.inverse().containsKey(dexName)) { return primitiveMap.inverse().get(dexName); } return dexName.replace('/', '.').substring(1, dexName.length()-2); } }
public static String dexToJavaName(String dexName) { if (dexName.charAt(0) == '[') { return dexName.replace('/', '.'); } if (primitiveMap.inverse().containsKey(dexName)) { return primitiveMap.inverse().get(dexName); } return dexName.replace('/', '.').substring(1, dexName.length()-2); } }
@Override public void insertionIdsAdded(final InsertionIds ids) { for (final SinglePartitionInsertionIds partitionIds : ids.getPartitionKeys()) { final byte first = partitionIds.getPartitionKey()[0]; if (orderedTierIdToSfcIndex.containsKey(first)) { tierCounts[orderedTierIdToSfcIndex.get(first).intValue()] += partitionIds.getSortKeys().size(); } } }
@Override public void insertionIdsRemoved(final InsertionIds ids) { for (final SinglePartitionInsertionIds partitionIds : ids.getPartitionKeys()) { final byte first = partitionIds.getPartitionKey()[0]; if (orderedTierIdToSfcIndex.containsKey(first)) { tierCounts[orderedTierIdToSfcIndex.get(partitionIds.getPartitionKey()[0]).intValue()] -= partitionIds.getSortKeys().size(); } } }
/** returns name of primitive corresponding to the given (boxed or unboxed) type */ public static Maybe<String> getPrimitiveName(Class<?> type) { if (type!=null) { if (PRIMITIVE_TO_BOXED.containsKey(type)) return Maybe.of(type.getName()); if (PRIMITIVE_TO_BOXED.containsValue(type)) { return Maybe.of(PRIMITIVE_TO_BOXED.inverse().get(type).getName()); } } return Maybe.absent("Not a primitive or boxed primitive: "+type); }