Files
School/Anul 2/Semestrul 1/Metode avansate de programare/Interpretor/Models/Values/BooleanValue.java
T
2024-08-31 12:07:21 +03:00

36 lines
768 B
Java

package Models.Values;
import Models.Types.IType;
import Models.Types.BooleanType;
public class BooleanValue implements IValue {
//#region Fields
private boolean value;
//#endregion
//#region Exposed Methods
public BooleanValue(boolean value){
this.value = value;
}
public boolean getValue(){
return this.value;
}
public String toString(){
return Boolean.toString(this.value);
}
public IType getType(){
return new BooleanType();
}
public boolean equals(Object other){
if(other instanceof BooleanValue){
var otherValue = (BooleanValue)other;
return otherValue.getValue() == this.value;
}
return false;
}
//#endregion
}