Class SolutionLoader

java.lang.Object
com.expedient.adventofcodejade.common.SolutionLoader

public class SolutionLoader extends Object
Class responsible for dynamically loading Solutions located in com.expedient.adventofcodejade.solutions.
  • Constructor Details

    • SolutionLoader

      public SolutionLoader(String inputsDirectory, String solutionsPackage)
    • SolutionLoader

      public SolutionLoader()
  • Method Details

    • loadForDay

      public BaseSolution loadForDay(int year, int day, boolean test) throws ClassNotFoundException, RuntimeException, IOException
      Dynamically load the Solution class in the package for the given day
      Parameters:
      day - the day of the month to use for the solution
      Returns:
      The BaseSolution instance for the given day, located in the day's respective package as a class named "Solution"
      Throws:
      ClassNotFoundException - there's no class for the given day
      RuntimeException - there's some other error with the constructor or something
      IOException - the sample input could not be found
    • loadSolutions

      public BaseSolution[] loadSolutions(int year, boolean test) throws RuntimeException
      Tries to get solutions for days 1-25, breaks out of the loop is any are missing. There should never be more than 25 days before Christmas lol
      Returns:
      Array of BaseSolution instances
      Throws:
      RuntimeException - Some error was encountered instantiating the classes