37 lines
753 B
Java
37 lines
753 B
Java
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
|
|
}
|