package st; public class TypeInstance extends AbstractInstance { public TypeInstance(String name, TypeEnum type) { super(name, type); } public String toString() { return this.name + ":" + this.type; } public boolean same_type(TypeInstance other) { /** * Given a TypeInstance object other, * returns true if other object * is the same type as this one. * * We can say two types are equal, as * long as they are not equal on a * type error! */ return this.type != TypeEnum.ERROR && this.type == other.get_type(); } public boolean has_checked() { return type != TypeEnum.ERROR; } }