mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-22 15:30:09 -08:00
Fix copy pasting in NaiveNumber.
This commit is contained in:
parent
aec9953af2
commit
7fdae4285b
|
@ -15,26 +15,22 @@ public class NaiveNumber implements Number {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Number multiply(Number multiplier) {
|
public Number multiply(Number multiplier) {
|
||||||
if(!(multiplier instanceof NaiveNumber)) throw new IllegalArgumentException();
|
|
||||||
return new NaiveNumber(value * ((NaiveNumber)multiplier).value);
|
return new NaiveNumber(value * ((NaiveNumber)multiplier).value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Number divide(Number divisor) {
|
public Number divide(Number divisor) {
|
||||||
if(!(divisor instanceof NaiveNumber)) throw new IllegalArgumentException();
|
return new NaiveNumber(value / ((NaiveNumber)divisor).value);
|
||||||
return new NaiveNumber(value * ((NaiveNumber)divisor).value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Number add(Number summand) {
|
public Number add(Number summand) {
|
||||||
if(!(summand instanceof NaiveNumber)) throw new IllegalArgumentException();
|
return new NaiveNumber(value + ((NaiveNumber)summand).value);
|
||||||
return new NaiveNumber(value * ((NaiveNumber)summand).value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Number subtract(Number subtrahend) {
|
public Number subtract(Number subtrahend) {
|
||||||
if(!(subtrahend instanceof NaiveNumber)) throw new IllegalArgumentException();
|
return new NaiveNumber(value - ((NaiveNumber)subtrahend).value);
|
||||||
return new NaiveNumber(value * ((NaiveNumber)subtrahend).value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user