School Commit Init
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
package Models.Values;
|
||||
|
||||
import Models.Types.IType;
|
||||
import Models.Types.StringType;
|
||||
|
||||
public class StringValue implements IValue {
|
||||
private String value;
|
||||
|
||||
public StringValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public boolean equals(Object other) {
|
||||
if (other instanceof StringValue) {
|
||||
var otherValue = (StringValue) other;
|
||||
return otherValue.getValue().equals(this.value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public IValue copy() {
|
||||
return new StringValue(this.value);
|
||||
}
|
||||
|
||||
public IType getType() {
|
||||
return new StringType();
|
||||
}
|
||||
|
||||
public boolean equals(IValue other) {
|
||||
if (other instanceof StringValue) {
|
||||
var otherValue = (StringValue) other;
|
||||
return otherValue.getValue().equals(this.value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user