School Commit Init

This commit is contained in:
2024-08-31 12:07:21 +03:00
commit 0b130ee18c
2801 changed files with 4720552 additions and 0 deletions
@@ -0,0 +1,35 @@
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
}
@@ -0,0 +1,7 @@
package Models.Values;
import Models.Types.IType;
public interface IValue {
public IType getType();
}
@@ -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
}
@@ -0,0 +1,22 @@
package Models.Values;
import Models.Types.IType;
import Models.Types.ReferenceType;
public class ReferenceValue implements IValue {
private Integer address;
private IType locationType;
public ReferenceValue(Integer address, IType locationType) {
this.address = address;
this.locationType = locationType;
}
public Integer getAddress() {
return this.address;
}
public IType getType() {
return new ReferenceType(this.locationType);
}
}
@@ -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;
}
}