package de.dhbwstuttgart.strucTypes4.syntaxtree;

import de.dhbwstuttgart.strucTypes4.typeVars.TypeVarStore;

/**
 * Created by sebastian on 07.04.17.
 */
public class Field  extends SyntaxNode {

    private String var_name;
    private String type;

    public Field(String type, String var_name) {
        this.var_name = var_name;
        this.type = type;
    }

    public String getVar_name() {
        return var_name;
    }

    public void setVar_name(String var_name) {
        this.var_name = var_name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }


    @Override
    public String toString() {
        return String.format("Feld: %s %s " , type , var_name);
    }

    @Override
    public String toCodeTPH() {
        return String.format("Feld %s %s : %s" , type, var_name , getTypePlaceHolder());
    }

    @Override
    public String toCodeTyped(TypeVarStore typeVarStore) {
        return String.format("Feld %s %s : %s" , type, var_name , typeVarStore.getTypeVarByTPH(getTypePlaceHolder()));
    }

}
