1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-11-05 18:29:53 -08:00

Add promotion implementation.

This commit is contained in:
Danila Fedorin 2017-07-24 14:37:56 -07:00
parent 7bab3773dc
commit 6919fac18f
2 changed files with 7 additions and 0 deletions

View File

@ -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;
}
} }

View File

@ -12,4 +12,6 @@ public interface Number {
Number zero(); Number zero();
Number one(); Number one();
Number promoteTo(Class<? extends Number> toClass);
} }