package com.jraska.vsb.or1;

import com.jraska.vsb.or1.data.Input;
import com.jraska.vsb.or1.data.Output;
import com.jraska.vsb.or1.io.SimpleTextParser;
import com.jraska.vsb.or1.io.ToStringOutputWriter;
import com.jraska.vsb.or1.schedule.SimpleScheduler;
import com.jraska.vsb.or1.schedule.validation.NoWaitFlowShopValidator;

import java.io.File;
import java.io.FileInputStream;
import java.io.PrintStream;
import java.util.List;

public final class Program
{
	//region Main method

	public static void main(String args[]) throws Exception
	{
		Program program = new Program();
		program.run(args);
	}

	//endregion

	//region Fields

	private final PrintStream out;

	//endregion

	//region Constructors

	public Program()
	{
		this(System.out);
	}

	public Program(PrintStream out)
	{
		this.out = out;
	}

	//endregion

	//region methods

	public void run(String args[]) throws Exception
	{
		if (args.length < 1)
		{
			throw new IllegalArgumentException("There must be arg with file path.");
		}

		String path = args[0];

		FileInputStream fileInputStream = new FileInputStream(new File(path));
		SimpleTextParser parser = new SimpleTextParser();
		Input input = parser.parse(fileInputStream);
		fileInputStream.close();

		SimpleScheduler scheduler = new SimpleScheduler();
		Output output = scheduler.schedule(input);

		ToStringOutputWriter toStringOutputWriter = new ToStringOutputWriter();
		toStringOutputWriter.write(output, System.out);

		NoWaitFlowShopValidator validator = new NoWaitFlowShopValidator();
		List<String> validationResult = validator.validate(output);

		if (!validationResult.isEmpty())
		{
			out.println();
			out.println("-------------------");
			out.println("RESULT IS NOT VALID");
			out.println("-------------------");

			for (String error : validationResult)
			{
				out.println(error);
			}
		}
	}

	//endregion
}

@@ -232,31 +232,395 @@
 chedule.
-SimpleScheduler
+IScheduler;%0Aimport com.jraska.vsb.or1.schedule.RandomPositionGenerator;%0Aimport com.jraska.vsb.or1.schedule.SimpleScheduler;%0Aimport com.jraska.vsb.or1.schedule.Swap;%0Aimport com.jraska.vsb.or1.schedule.abc.ABCScheduler;%0Aimport com.jraska.vsb.or1.schedule.abc.Bee;%0Aimport com.jraska.vsb.or1.schedule.abc.MakespanCounter;%0Aimport com.jraska.vsb.or1.schedule.abc.RouletteWheelSelection
 ;%0Aimport
@@ -1587,16 +1587,111 @@
 ose();%0A%0A
+%09%09IScheduler scheduler = createScheduler(input);%0A%09%09Output output = scheduler.schedule(input);%0A%0A
 %09%09Simple
@@ -1692,33 +1692,42 @@
 SimpleScheduler 
-s
+referenceS
 cheduler = new S
@@ -1749,34 +1749,43 @@
 );%0A%09%09Output 
-output = s
+simple = referenceS
 cheduler.sch
@@ -1799,16 +1799,76 @@
 nput);%0A%0A
+%09%09out.println(%22Simple Makespan: %22 + simple.getMakespan());%0A%0A
 %09%09ToStri
@@ -2370,24 +2370,593 @@
 %09%09%7D%0A%09%09%7D%0A%09%7D%0A%0A
+%09protected IScheduler createScheduler(Input input)%0A%09%7B%0A%09%09MakespanCounter makespanCounter = new MakespanCounter(input.getJobs());%0A%09%09RandomPositionGenerator randomPositionGenerator = new RandomPositionGenerator(input.getJobsCount());%0A%09%09RouletteWheelSelection wheelSelection = new RouletteWheelSelection();%0A%0A%09%09Swap swap = new Swap();%0A%09%09Bee%5B%5D bees = new Bee%5B20%5D;%0A%09%09for (int i = 0; i %3C 20; i++)%0A%09%09%7B%0A%09%09%09bees%5Bi%5D = new Bee(swap, makespanCounter);%0A%09%09%7D%0A%0A%09%09ABCScheduler abcScheduler = new ABCScheduler(bees, randomPositionGenerator, wheelSelection, 10);%0A%09%09return abcScheduler;%0A%09%7D%0A%0A
 %09//endregion

Add first version of ABC to command line app