School Commit Init
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
package Models.Values;
|
||||
|
||||
import Models.Types.IType;
|
||||
import Models.Types.IntegerType;
|
||||
|
||||
public class IntegerValue implements IValue {
|
||||
//#region Fields
|
||||
private int value;
|
||||
//#endregion
|
||||
|
||||
//#region Exposed Methods
|
||||
public IntegerValue(int value){
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue(){
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return Integer.toString(this.value);
|
||||
}
|
||||
|
||||
public IType getType(){
|
||||
return new IntegerType();
|
||||
}
|
||||
|
||||
public boolean equals(Object other){
|
||||
if(other instanceof IntegerValue){
|
||||
var otherValue = (IntegerValue)other;
|
||||
return otherValue.getValue() == this.value;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user