package de.dhbwstuttgart.strucTypes5.typeVars;

import de.dhbwstuttgart.syntaxtree.type.RefType;

/**
 * Created by sebastian on 30.04.17.
 */
public class TypeVarRefType extends TypeVarAbstract {

    private RefType refType;

    public TypeVarRefType(RefType refType) {
        this.refType = refType;
    }

    public RefType getRefType() {
        return refType;
    }

    public void setRefType(RefType refType) {
        this.refType = refType;
    }


    /*
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof TypeVarRefType)) return false;

        TypeVarRefType that = (TypeVarRefType) o;

        return getRefType() != null ? getRefType().equals(that.getRefType()) : that.getRefType() == null;
    }
    */

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof TypeVarRefType)) return false;

        TypeVarRefType that = (TypeVarRefType) o;

        if (that.toString().equals(this.toString())) {
            return true;
        }
        else {
            return false;
        }
    }





    @Override
    public String toString() {
        return String.format("TVar_%s" , refType.toString());
    }
}
