mirror of
https://github.com/DanilaFe/abacus
synced 2024-11-05 18:29:53 -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);
|
||||
}
|
||||
|
||||
@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 one();
|
||||
|
||||
Number promoteTo(Class<? extends Number> toClass);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user