package control;

import de.dhbwstuttgart.strucTypes4.parserFWJ.Parser;
import de.dhbwstuttgart.strucTypes4.syntaxtree.Class;
import de.dhbwstuttgart.strucTypes4.syntaxtree.Field;
import de.dhbwstuttgart.strucTypes4.syntaxtree.Method;

import de.dhbwstuttgart.strucTypes4.typeVars.TypeVarAbstract;
import de.dhbwstuttgart.strucTypes4.typeVars.TypeVarType;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by sebastian on 12.04.17.
 */
public class Start {


    Map<String, TypeVarAbstract> assumptionsGlobal = new HashMap<>();
    List<Class> results = new ArrayList<>();


    public Start(String... argsPfade ) {


        // set my Integer
        ArrayList<Method> methods = new ArrayList<>();
        ArrayList<Field> fields = new ArrayList<>();

        //Class myInteger = new Class("MyInteger", fields, methods );
        //ArrayList<ConstraintAbstract> constraints = new ArrayList<>();
        //myInteger.setConstraintSet(constraints);


        //assumptionsGlobal.put("$MyInteger" , new TypeVarType(myInteger));

        for (String arg : argsPfade) {
            parseKlasse(arg);
        }
    }

    private void parseKlasse(String pfad) {
        Parser p = new Parser();
        Class classTyped = p.parseCode(ReadIn.read(pfad), assumptionsGlobal);
        TypeVarType typeVarType = new TypeVarType(classTyped);

        assumptionsGlobal.put("$" + classTyped.getName() , typeVarType);
        results.add(classTyped);
    }
}
