@Override public boolean equals(Object other) { if (!(other instanceof NumberData)) { return false; } if (other instanceof IntegerData) { return this.value == ((IntegerData) other).value; } else { return super.equals(other); } } }
@Override public double numberValue() { return toFloat(); }
public static BooleanData $$lessThanOrEqual(NumberData operand0, NumberData operand1) { if (operand0 instanceof IntegerData && operand1 instanceof IntegerData) { return BooleanData.forValue(operand0.integerValue() <= operand1.integerValue()); } else { return BooleanData.forValue(operand0.numberValue() <= operand1.numberValue()); } }
public static NumberData $$negative(NumberData operand) { if (operand instanceof IntegerData) { return IntegerData.forValue( - operand.integerValue() ); } else { return FloatData.forValue( - operand.floatValue() ); } }
public static NumberData $$round( NumberData valueData, @Nullable IntegerData numDigitsAfterPtData) { int numDigitsAfterPt = (numDigitsAfterPtData != null) ? numDigitsAfterPtData.integerValue() : 0 /* default */; if (numDigitsAfterPt == 0) { if (valueData instanceof IntegerData) { return valueData; } else { return IntegerData.forValue((int) Math.round(valueData.numberValue())); } } else if (numDigitsAfterPt > 0) { double value = valueData.numberValue(); double shift = Math.pow(10, numDigitsAfterPt); return FloatData.forValue(Math.round(value * shift) / shift); } else { double value = valueData.numberValue(); double shift = Math.pow(10, -numDigitsAfterPt); return IntegerData.forValue((int) (Math.round(value / shift) * shift)); } }
public static BooleanData $$lessThan(NumberData operand0, NumberData operand1) { if (operand0 instanceof IntegerData && operand1 instanceof IntegerData) { return BooleanData.forValue(operand0.integerValue() < operand1.integerValue()); } else { return BooleanData.forValue(operand0.numberValue() < operand1.numberValue()); } }
public static NumberData $$minus(NumberData operand0, NumberData operand1) { if (operand0 instanceof IntegerData && operand1 instanceof IntegerData) { return IntegerData.forValue(operand0.integerValue() - operand1.integerValue()); } else { return FloatData.forValue(operand0.numberValue() - operand1.numberValue()); } }
@Override public boolean equals(Object other) { if (!(other instanceof NumberData)) { return false; } if (other instanceof IntegerData) { return this.value == ((IntegerData) other).value; } else { return super.equals(other); } } }
@Override public double numberValue() { return toFloat(); }
public static BooleanData $$greaterThan(NumberData operand0, NumberData operand1) { if (operand0 instanceof IntegerData && operand1 instanceof IntegerData) { return BooleanData.forValue(operand0.integerValue() > operand1.integerValue()); } else { return BooleanData.forValue(operand0.numberValue() > operand1.numberValue()); } }
@Override public boolean equals(Object other) { if (other == null || !(other instanceof NumberData)) { return false; } if (other instanceof IntegerData) { return value == ((IntegerData) other).getValue(); } else { return super.equals(other); } }
public static NumberData $$times(NumberData operand0, NumberData operand1) { if (operand0 instanceof IntegerData && operand1 instanceof IntegerData) { return IntegerData.forValue(operand0.integerValue() * operand1.integerValue()); } else { return FloatData.forValue(operand0.numberValue() * operand1.numberValue()); } }
@Override public double numberValue() { return toFloat(); }
public static BooleanData $$greaterThanOrEqual(NumberData operand0, NumberData operand1) { if (operand0 instanceof IntegerData && operand1 instanceof IntegerData) { return BooleanData.forValue(operand0.integerValue() >= operand1.integerValue()); } else { return BooleanData.forValue(operand0.numberValue() >= operand1.numberValue()); } }
public static NumberData $$min(NumberData arg0, NumberData arg1) { if (arg0 instanceof IntegerData && arg1 instanceof IntegerData) { return IntegerData.forValue(Math.min(arg0.integerValue(), arg1.integerValue())); } else { return FloatData.forValue(Math.min(arg0.numberValue(), arg1.numberValue())); } }
@Override public int hashCode() { return (new Double(toFloat())).hashCode(); }
public static NumberData $$max(NumberData arg0, NumberData arg1) { if (arg0 instanceof IntegerData && arg1 instanceof IntegerData) { return IntegerData.forValue(Math.max(arg0.integerValue(), arg1.integerValue())); } else { return FloatData.forValue(Math.max(arg0.numberValue(), arg1.numberValue())); } } }