package st; public class TypeInstance extends AbstractInstance { protected ClassInstance par_cls; // the surrounding class protected MethodInstance par_mtd; // the surrounding method protected ClassInstance cls; // the class instance public TypeInstance(String name, TypeEnum type, MethodInstance par_mtd, ClassInstance par_cls) { super(name, type); this.par_cls = par_cls; this.par_mtd = par_mtd; } @Override public boolean equals(Object other) { TypeInstance o; return (other instanceof TypeInstance && ((o = (TypeInstance) other).getName() == this.getName() && o.getParentClass() == this.getParentClass() && o.getParentMethod() == this.getParentMethod())); } public int getSize() { return (this.cls != null) ? cls.getSize() : 4; } public void addClassInstance(ClassInstance cls) { this.cls = cls; } public ClassInstance getClassInstance() { return this.cls; } public void addParentClass(ClassInstance par_cls) { this.par_cls = par_cls; } public ClassInstance getParentClass() { return this.par_cls; } public void addParentMethod(MethodInstance par_mtd) { this.par_mtd = par_mtd; } public MethodInstance getParentMethod() { return this.par_mtd; } }