@SuppressWarnings("unchecked") public static <T> T coerce(Object obj, Class<T> type) { // can't use `type.cast()` because it will fail if `type` is a primitive type return (T) DefaultTypeTransformation.castToType(obj, type); }
public static boolean isTruthy(Object obj) { return DefaultTypeTransformation.castToBoolean(obj); }
/** * Bitwise AND together two Numbers. * * @param left a Number * @param right another Number to bitwise AND * @return the bitwise AND of both Numbers * @since 1.0 */ public static Number and(Number left, Number right) { return NumberMath.and(left, right); }
public NumberNumberCallSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod, Class[] params, Number receiver, Number arg) { super(site, metaClass, metaMethod, params); math = NumberMath.getMath(receiver,arg); } }
public static double plus(byte op1, float op2) { if (instance.byte_plus) { return plusSlow(op1, op2); } else { return ((double) op1) + ((double) op2); } }
public static int multiply(short op1, int op2) { if (instance.short_multiply) { return multiplySlow(op1, op2); } else { return ((int) op1) * op2; } }
public static int leftShift(byte op1, byte op2) { if (instance.byte_leftShift) { return leftShiftSlow(op1, op2); } else { return ((int) op1) << ((int) op2); } }
public static long or(byte op1, long op2) { if (instance.byte_or) { return orSlow(op1, op2); } else { return ((long) op1) | op2; } }
public static int intdiv(short op1, int op2) { if (instance.short_intdiv) { return intdivSlow(op1, op2); } else { return ((int) op1) / op2; } }
public static double div(float op1, float op2) { if (instance.float_div) { return divSlow(op1, op2); } else { return ((double) op1) / ((double) op2); } }
public static long mod(long op1, byte op2) { if (instance.long_mod) { return modSlow(op1, op2); } else { return op1 % ((long) op2); } }
public static int rightShift(int op1, byte op2) { if (instance.int_rightShift) { return rightShiftSlow(op1, op2); } else { return op1 >> ((int) op2); } }
public static int plus(short op1, int op2) { if (instance.short_plus) { return plusSlow(op1, op2); } else { return ((int) op1) + op2; } }
public static long multiply(long op1, long op2) { if (instance.long_multiply) { return multiplySlow(op1, op2); } else { return op1 * op2; } }
public static int leftShift(int op1, int op2) { if (instance.int_leftShift) { return leftShiftSlow(op1, op2); } else { return op1 << op2; } }
public static long or(int op1, long op2) { if (instance.int_or) { return orSlow(op1, op2); } else { return ((long) op1) | op2; } }
public static int intdiv(int op1, short op2) { if (instance.int_intdiv) { return intdivSlow(op1, op2); } else { return op1 / ((int) op2); } }
public static double plus(short op1, float op2) { if (instance.short_plus) { return plusSlow(op1, op2); } else { return ((double) op1) + ((double) op2); } }
public static double multiply(double op1, short op2) { if (instance.double_multiply) { return multiplySlow(op1, op2); } else { return op1 * ((double) op2); } }
public static long leftShift(long op1, short op2) { if (instance.long_leftShift) { return leftShiftSlow(op1, op2); } else { return op1 << ((long) op2); } }