package de.dhbwstuttgart.strucTypes5.constraints;

import de.dhbwstuttgart.strucTypes5.typeVars.TypeVarAbstract;
import de.dhbwstuttgart.strucTypes5.typeVars.TypeVarInterface;

/**
 * Created by sebastian on 20.04.17.
 */
public abstract class ConstraintAbstract {

    public boolean replaceTypeVarAbstract(TypeVarAbstract alt, TypeVarAbstract neu) {
        return false;
    }



    public static TypeVarAbstract helpChange(TypeVarAbstract old, TypeVarAbstract neu, TypeVarAbstract inFrage) {
        if (inFrage instanceof TypeVarInterface) {
            ((TypeVarInterface) inFrage).getInterfaceForConstraint().replaceTypeVarAbstract(old,neu);
            return inFrage;
        }
        else {
            return neu;
        }
    }


    public static boolean helpChange2(TypeVarAbstract old, TypeVarAbstract neu, TypeVarAbstract inFrage) {
        if (inFrage instanceof TypeVarInterface) {
            ConstraintAbstract.helpChange(old,neu,inFrage);
            return true;
        }
        return false;
    }



}
