@@ -0,0 +1,2450 @@
+package com.gondor.kata;%0A%0Aimport com.gondor.kata.cli.CommandLineParser;%0Aimport com.gondor.kata.cli.PaintShopOptions;%0Aimport com.gondor.kata.cli.exception.InvalidCommandLineArgumentsException;%0Aimport com.gondor.kata.model.Problem;%0Aimport com.gondor.kata.model.Solution;%0Aimport com.gondor.kata.model.Strategy;%0Aimport com.gondor.kata.output.OutputFormatter;%0Aimport com.gondor.kata.output.TextOutput;%0Aimport com.gondor.kata.parser.FileParser;%0Aimport com.gondor.kata.parser.exception.ParsingException;%0Aimport com.gondor.kata.solver.Solver;%0Aimport com.gondor.kata.solver.SolverFactory;%0Aimport com.google.devtools.common.options.OptionsParser;%0Aimport org.jetbrains.annotations.NotNull;%0A%0Aimport java.io.File;%0Aimport java.util.Optional;%0A%0A/**%0A * Created by coding on 18/09/2017.%0A */%0Apublic class Application %7B%0A%0A    @NotNull%0A    public static PaintShopOptions parseCommandLine(String%5B%5D args) %7B%0A        PaintShopOptions options = CommandLineParser.parse(args);%0A        System.out.format(%22Solving problem at %25s using strategy %25s...%5Cn%22, options.filePath, options.strategy);%0A        return options;%0A    %7D%0A%0A    public static Problem loadProblem(File filePath) throws ParsingException %7B%0A        FileParser parser = new FileParser();%0A        return parser.parse(filePath);%0A    %7D%0A%0A    @NotNull%0A    public static Optional%3CSolution%3E solveProblem(Strategy strategy, Problem problem) %7B%0A        Solver solver = SolverFactory.solver(strategy, problem);%0A        solver.solve();%0A        return solver.solution();%0A    %7D%0A%0A    public static String outputSolution(Optional%3CSolution%3E solution) %7B%0A        OutputFormatter outputFormatter = new TextOutput(solution);%0A        return outputFormatter.printResult();%0A    %7D%0A%0A    public static void main(String args%5B%5D) %7B%0A%0A        try %7B%0A            PaintShopOptions options = parseCommandLine(args);%0A%0A            File inputFile = new File(options.filePath);%0A            Problem problem = loadProblem(inputFile);%0A%0A            Strategy strategy = Strategy.valueOf(options.strategy);%0A            Optional%3CSolution%3E solution = solveProblem(strategy, problem);%0A%0A            String palettePicks = outputSolution(solution);%0A%0A            System.out.println(palettePicks);%0A        %7D catch (InvalidCommandLineArgumentsException e) %7B%0A            CommandLineParser.printUsage(OptionsParser.newOptionsParser(PaintShopOptions.class), e.getMessage());%0A        %7D catch (ParsingException e) %7B%0A            System.out.println(e.getMessage());%0A        %7D%0A    %7D%0A%0A%7D

add the paintshop app driver