package models;
import lombok.Getter;
import models.algebra.Symbol;
import models.algebra.Type;
@Getter
public class ResourceConstant extends EvaluatableTerm{
private String name;
private Type type;
public ResourceConstant(String name) {
super(new Symbol("", 0), 0);
this.name = name;
this.type = null;
}
public ResourceConstant(String name, Type type) {
super(new Symbol("", 0), 0);
this.name = name;
this.type = type;
}
@Override
public boolean isLinearRightNormal() {
return true;
}
@Override
public EvaluatableTerm linearRightNormalize() {
return (ResourceConstant) clone();
}
@Override
public void selfLinearRightNormalize() {
}
@Override
public boolean equals(Object another) {
if(! (another instanceof ResourceConstant)) {
return false;
}
var cons = (ResourceConstant) another;
return cons.getOrder() == getOrder() && cons.getName().equals(getName());
}
@Override
public int hashCode() {
return ("Const" + toStringWithOrder()).hashCode();
}
@Override
public String toString() {
return this.name;
}
@Override
public String toStringWithOrder() {
return this.name + "(" + order + ")";
}
@Override
public Object clone() {
return new ResourceConstant(name, type);
}
}