mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-22 07:20:09 -08:00
Add promotion implementation.
This commit is contained in:
parent
7bab3773dc
commit
6919fac18f
|
@ -48,5 +48,10 @@ public class NaiveNumber implements Number {
|
||||||
return new NaiveNumber(1);
|
return new NaiveNumber(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Number promoteTo(Class<? extends Number> toClass) {
|
||||||
|
if(toClass == this.getClass()) return this;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,4 +12,6 @@ public interface Number {
|
||||||
Number zero();
|
Number zero();
|
||||||
Number one();
|
Number one();
|
||||||
|
|
||||||
|
Number promoteTo(Class<? extends Number> toClass);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user