protected final Number coerce(final Object obj) { if (isNumber(obj)) { return coerce((Number) obj); } if (obj == null || "".equals(obj)) { return coerce(ZERO); } if (obj instanceof String) { return coerce((String) obj); } if (obj instanceof Character) { return coerce(Short.valueOf((short) ((Character) obj).charValue())); } throw MESSAGES.errorConvertingWithException(obj, obj.getClass(), "Number"); }
protected final Number coerce(final Object obj) { if (isNumber(obj)) { return coerce((Number) obj); } if (obj == null || "".equals(obj)) { return coerce(ZERO); } if (obj instanceof String) { return coerce((String) obj); } if (obj instanceof Character) { return coerce(Short.valueOf((short) ((Character) obj).charValue())); } throw new IllegalArgumentException(MessageFactory.get("error.convert", obj, obj.getClass(), "Number")); }
protected final Number coerce(final Object obj) { if (isNumber(obj)) { return coerce((Number) obj); } if (obj == null || "".equals(obj)) { return coerce(ZERO); } if (obj instanceof String) { return coerce((String) obj); } if (obj instanceof Character) { return coerce(Short.valueOf((short) ((Character) obj).charValue())); } throw new IllegalArgumentException(MessageFactory.get("error.convert", obj, obj.getClass(), "Number")); }
protected final Number coerce(final Object obj) { if (isNumber(obj)) { return coerce((Number) obj); } if (obj instanceof String) { return coerce((String) obj); } if (obj == null || "".equals(obj)) { return coerce(ZERO); } if (obj instanceof Character) { return coerce(new Short((short) ((Character) obj).charValue())); } throw new IllegalArgumentException(MessageFactory.get("error.convert", obj, obj.getClass(), "Number")); }
protected final Number coerce(final Object obj) { if (isNumber(obj)) { return coerce((Number) obj); } if (obj instanceof String) { return coerce((String) obj); } if (obj == null || "".equals(obj)) { return coerce(ZERO); } if (obj instanceof Character) { return coerce(Short.valueOf((short) ((Character) obj).charValue())); } throw new IllegalArgumentException(MessageFactory.get("error.convert", obj, obj.getClass(), "Number")); }
protected final Number coerce(final Object obj) { if (isNumber(obj)) { return coerce((Number) obj); } if (obj == null || "".equals(obj)) { return coerce(ZERO); } if (obj instanceof String) { return coerce((String) obj); } if (obj instanceof Character) { return coerce(Short.valueOf((short) ((Character) obj).charValue())); } throw new IllegalArgumentException(MessageFactory.get("error.convert", obj, obj.getClass(), "Number")); }
public static final Number divide(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return ZERO; } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = BIGDECIMAL; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGDECIMAL; else delegate = DOUBLE; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.divide(num0, num1); }
public static final Number divide(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return ZERO; } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = BIGDECIMAL; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGDECIMAL; else delegate = DOUBLE; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.divide(num0, num1); }
public static final Number divide(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return ZERO; } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = BIGDECIMAL; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGDECIMAL; else delegate = DOUBLE; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.divide(num0, num1); }
public static final Number divide(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return ZERO; } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = BIGDECIMAL; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGDECIMAL; else delegate = DOUBLE; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.divide(num0, num1); }
public final static Number divide(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return ZERO; } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = BIGDECIMAL; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGDECIMAL; else delegate = DOUBLE; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.divide(num0, num1); }
public static final Number divide(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return ZERO; } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = BIGDECIMAL; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGDECIMAL; else delegate = DOUBLE; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.divide(num0, num1); }
public static final Number mod(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return Long.valueOf(0); } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = DOUBLE; else if (DOUBLE.matches(obj0, obj1)) delegate = DOUBLE; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGINTEGER; else delegate = LONG; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.mod(num0, num1); }
public static final Number mod(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return Long.valueOf(0); } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = DOUBLE; else if (DOUBLE.matches(obj0, obj1)) delegate = DOUBLE; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGINTEGER; else delegate = LONG; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.mod(num0, num1); }
public static final Number mod(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return Long.valueOf(0); } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = DOUBLE; else if (DOUBLE.matches(obj0, obj1)) delegate = DOUBLE; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGINTEGER; else delegate = LONG; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.mod(num0, num1); }
public final static Number subtract(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return new Long(0); } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = BIGDECIMAL; else if (DOUBLE.matches(obj0, obj1)) delegate = DOUBLE; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGINTEGER; else delegate = LONG; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.subtract(num0, num1); }
public static final Number add(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return Long.valueOf(0); } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = BIGDECIMAL; else if (DOUBLE.matches(obj0, obj1)) { if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGDECIMAL; else delegate = DOUBLE; } else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGINTEGER; else delegate = LONG; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.add(num0, num1); }