Word abstract -> interface
This commit is contained in:
parent
1bdb35a899
commit
422344097b
3 changed files with 10 additions and 10 deletions
|
@ -1,11 +1,11 @@
|
||||||
package hatelace;
|
package hatelace;
|
||||||
|
|
||||||
public abstract class Word {
|
public interface Word {
|
||||||
public abstract <T> T getValue();
|
<T> T getValue();
|
||||||
public abstract Word add(Word other);
|
Word add(Word other);
|
||||||
public abstract Word subtract(Word other);
|
Word subtract(Word other);
|
||||||
public abstract Word multiply(Word other);
|
Word multiply(Word other);
|
||||||
public abstract Word divide(Word other);
|
Word divide(Word other);
|
||||||
public abstract String toString();
|
String toString();
|
||||||
public abstract boolean equals(Object other);
|
boolean equals(Object other);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package hatelace.memtypes;
|
||||||
|
|
||||||
import hatelace.Word;
|
import hatelace.Word;
|
||||||
|
|
||||||
public class IntWord extends Word {
|
public class IntWord implements Word {
|
||||||
private Integer value;
|
private Integer value;
|
||||||
|
|
||||||
public IntWord(Integer value) {
|
public IntWord(Integer value) {
|
||||||
|
|
|
@ -2,7 +2,7 @@ package hatelace.memtypes;
|
||||||
|
|
||||||
import hatelace.Word;
|
import hatelace.Word;
|
||||||
|
|
||||||
public class LongWord extends Word {
|
public class LongWord implements Word {
|
||||||
private Long value;
|
private Long value;
|
||||||
|
|
||||||
public LongWord(Long value) {
|
public LongWord(Long value) {
|
||||||
|
|
Loading…
Reference in a new issue