package heat; import st.TypeEnum; import st.ClassInstance; /** * A simple wrapper for TypeEnum, * meant to provide all helper methods * and structures for evaluating typing. */ class TypeBundle { private TypeEnum type; private ClassInstance instance; protected TypeBundle(TypeEnum type, ClassInstance instance) { this.type = type; this.instance = instance; } @Override public String toString() { String cls = (this.instance != null) ? String.format(" (%s)", this.instance) : ""; return String.format("%s%s", this.type, cls); } @Override public boolean equals(Object other) { return (other instanceof TypeBundle) && ((TypeBundle) other).type == this.type; } public boolean isClass() { return this.type == TypeEnum.classname; } public boolean isMethod() { return this.type == TypeEnum.method; } public boolean isArray() { return this.type == TypeEnum.intarray; } public boolean isBool() { return this.type == TypeEnum.bool; } public boolean isInt() { return this.type == TypeEnum.integer; } public TypeEnum getType() { return this.type; } }