public static ByteValue add(ByteValue value1, String value2) { if (value2 == null) { return value1; } if (value1 == null) { return new ByteValue(Byte.valueOf(value2)); } byte v = Byte.valueOf(value2); return new org.openl.meta.ByteValue(value1, new ByteValue(v), Operators.add(value1.getValue(), v), Formulas.ADD); }
public static double cast(ByteValue x, double y) { return x.doubleValue(); }
public static int cast(ByteValue x, int y) { return x.intValue(); }
/** * Is used to overload implicit cast operators from byte to * org.openl.meta.ByteValue * * @param x * @param y is needed to avoid ambiguity in Java method resolution * @return the casted value to org.openl.meta.ByteValue */ public static org.openl.meta.ByteValue autocast(byte x, org.openl.meta.ByteValue y) { return new org.openl.meta.ByteValue((byte) x); }
public static ByteValue divide(ByteValue value1, ByteValue value2) { if (value1 == null && value2 == null) { return null; } if (value1 == null) { if (value2 != null && value2.doubleValue() != 0) { return new ByteValue(value1, value2, divide(ByteValue.ONE, value2).getValue(), Formulas.DIVIDE); } } if (value2 == null) { return new ByteValue(value1, value2, value1.getValue(), Formulas.DIVIDE); } if (value2.doubleValue() == 0) { throw new OpenLRuntimeException("Division by zero"); } return new ByteValue(value1, value2, divide(value1.getValue(), value2.getValue()), Formulas.DIVIDE); }
public Byte marshal(ByteValue val) throws Exception { return val.getValue(); } }
/** * Subtracts left hand operand to right hand operand * * @param value1 org.openl.meta.ByteValue * @param value2 org.openl.meta.ByteValue * @return the result of subtraction operation */ public static org.openl.meta.ByteValue subtract(org.openl.meta.ByteValue value1, org.openl.meta.ByteValue value2) { // temporary commented to support operations with nulls // // validate(value1, value2, Formulas.SUBTRACT.toString()); if (value1 == null && value2 == null) { return null; } if (value1 == null) { return negative(value2); } if (value2 == null) { return value1; } return new org.openl.meta.ByteValue(value1, value2, Operators.subtract(value1.getValue(), value2.getValue()), Formulas.SUBTRACT); }
if (value2 != null && value2.doubleValue() != 0) { return new org.openl.meta.DoubleValue(null, new DoubleValue(value2.doubleValue()), divide(ONE, value2).getValue(), Formulas.DIVIDE); return new org.openl.meta.DoubleValue(new DoubleValue(value1.doubleValue()), null, value1.getValue(), Formulas.DIVIDE); if (value2.doubleValue() == 0) { throw new OpenLRuntimeException("Division by zero"); return new org.openl.meta.DoubleValue(new DoubleValue(value1.doubleValue()), new DoubleValue(value2.doubleValue()), Operators.divide(value1.getValue(), value2.getValue()), Formulas.DIVIDE);
/** Function constructor **/ public ByteValue(ByteValue result, NumberOperations function, ByteValue[] params) { super(function, params); this.value = result.byteValue(); }
private static DoubleValue[] toDoubleValues(org.openl.meta.ByteValue[] values) { if (values == null) { return null; } DoubleValue[] doubleValues = new DoubleValue[values.length]; int i = 0; for (ByteValue value : values) { doubleValues[i] = autocast(value, DoubleValue.ZERO); i++; } return doubleValues; }
/** * Copy the current value with new name <b>name</b> */ @Override public org.openl.meta.ByteValue copy(String name) { return copy(this, name); }
/** * * @param value * @return the <b>value</b> increased by 1 */ public static org.openl.meta.ByteValue inc(org.openl.meta.ByteValue value) { return add(value, ONE); }
/** * Is used to overload implicit cast operators from byte to * org.openl.meta.ByteValue * * @param x * @param y is needed to avoid ambiguity in Java method resolution * @return the casted value to org.openl.meta.ByteValue */ public static org.openl.meta.ByteValue autocast(byte x, org.openl.meta.ByteValue y) { return new org.openl.meta.ByteValue((byte) x); }
@Override public Byte convert(ByteValue param) { if (param == null) { return null; } return param.getValue(); };
/** * Subtracts left hand operand to right hand operand * * @param value1 org.openl.meta.ByteValue * @param value2 org.openl.meta.ByteValue * @return the result of subtraction operation */ public static org.openl.meta.ByteValue subtract(org.openl.meta.ByteValue value1, org.openl.meta.ByteValue value2) { // temporary commented to support operations with nulls // // validate(value1, value2, Formulas.SUBTRACT.toString()); if (value1 == null && value2 == null) { return null; } if (value1 == null) { return negative(value2); } if (value2 == null) { return value1; } return new org.openl.meta.ByteValue(value1, value2, Operators.subtract(value1.getValue(), value2.getValue()), Formulas.SUBTRACT); }
if (value2 != null && value2.doubleValue() != 0) { return new org.openl.meta.DoubleValue(null, new DoubleValue(value2.doubleValue()), divide(ONE, value2).getValue(), Formulas.DIVIDE); return new org.openl.meta.DoubleValue(new DoubleValue(value1.doubleValue()), null, value1.getValue(), Formulas.DIVIDE); if (value2.doubleValue() == 0) { throw new OpenLRuntimeException("Division by zero"); return new org.openl.meta.DoubleValue(new DoubleValue(value1.doubleValue()), new DoubleValue(value2.doubleValue()), Operators.divide(value1.getValue(), value2.getValue()), Formulas.DIVIDE);
/** Function constructor **/ public ByteValue(ByteValue result, NumberOperations function, ByteValue[] params) { super(function, params); this.value = result.byteValue(); }
private static DoubleValue[] toDoubleValues(org.openl.meta.ByteValue[] values) { if (values == null) { return null; } DoubleValue[] doubleValues = new DoubleValue[values.length]; int i = 0; for (ByteValue value : values) { doubleValues[i] = autocast(value, DoubleValue.ZERO); i++; } return doubleValues; }
/** * Copy the current value with new name <b>name</b> */ @Override public org.openl.meta.ByteValue copy(String name) { return copy(this, name); }
/** * * @param value * @return the <b>value</b> increased by 1 */ public static org.openl.meta.ByteValue inc(org.openl.meta.ByteValue value) { return add(value, ONE); }