package tests;
import PIANOS.datastructures.DistributionFactory;
import PIANOS.datastructures.ComputationalModel;
import PIANOS.io.ComputationalModelParser;
import PIANOS.exceptions.*;

// File, IOException, etc...
import java.io.*;

public class ModelFileReadTest{

    public static void main (String[] args){
	if (args.length == 3){
	    // userDistFile, modelFile, proposalFile
	    try{
	    DistributionFactory factory = new DistributionFactory(args[0]);
	    ComputationalModel model = ComputationalModelParser.modelTestOnly(args[1], args[2], factory);
	    // The parser with a little less properties
	    System.out.println("==========================");
	    System.out.println("Parsing complete. Results:");
	    System.out.println("==========================");
	    System.out.println(model);

	    }
	    catch (MissingDistributionException e){
		System.out.println(e.getMessage());
		System.exit(1);
	    }
	    catch (MissingFunctionException e){
		System.out.println(e.getMessage());
		System.exit(1);
	    }
	    catch (IOException e){
		System.out.println(e.getMessage());
		System.exit(1);
	    }
	    catch (SyntaxException e){
		System.out.println(e.getMessage());
		System.exit(1);
	    }
	}
    }
}

