| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-08-03 15:28:17 +0200 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-08-03 15:28:17 +0200 | 
| commit | 90bb7e959496c3a12bebe055f6344b9f06f22809 (patch) | |
| tree | 6635decc697d91c8cba6da9db8959b706ad9842f /sol_pretty_printer/src/Solutions.java | |
| parent | c5a23ef9d6ab1e89b85016831fc8b2431f68f87f (diff) | |
Improving clarity through better Makefiles.
Diffstat (limited to 'sol_pretty_printer/src/Solutions.java')
| -rw-r--r-- | sol_pretty_printer/src/Solutions.java | 96 | 
1 files changed, 0 insertions, 96 deletions
diff --git a/sol_pretty_printer/src/Solutions.java b/sol_pretty_printer/src/Solutions.java deleted file mode 100644 index 38a426a..0000000 --- a/sol_pretty_printer/src/Solutions.java +++ /dev/null @@ -1,96 +0,0 @@ -import java.util.Map; -import java.util.List; - -import java.io.IOException; - -import java.nio.file.Files; -import java.nio.file.Paths; -import java.nio.charset.StandardCharsets; - - -public class Solutions -{ -   private static String load_file (final String filename) -   throws IOException -   { -      return -         new String -         ( -            Files.readAllBytes(Paths.get(filename)), -            StandardCharsets.UTF_8 -         ); -   } - -   public static boolean print (final String sol_file, final String pp_file) -   throws IOException -   { -      final String pp_content; -      final QuickSolParser qsp; -      List<String[]> solution; - -      pp_content = load_file(pp_file); - -      qsp = new QuickSolParser(sol_file); - -      for (;;) -      { -         solution = qsp.next_solution(); - -         if (solution == null) -         { -            return true; -         } - -         if (!handle_solution(solution, pp_content)) -         { -            return false; -         } -      } -   } - -   private static boolean handle_solution -   ( -      final List<String[]> solution, -      String pp_content -   ) -   { -      for (final String[] sol_data: solution) -      { -         final SolutionItem si; - -         si = SolutionItem.get_item_from_id(sol_data[1]); - -         if (si == null) -         { -            System.err.println -            ( -               "[E] There is no element in the model with an ID of \"" -               + sol_data[1] -               + "\", yet the solution file refers to it." -            ); - -            return false; -         } - -         for (final Map.Entry<String, String> me: si.get_functions_data()) -         { -            pp_content = -               pp_content.replace -               ( -                  ( -                     "$" -                     + sol_data[0] -                     + "." -                     + me.getKey().toUpperCase() -                     + "$" -                  ), -                  Strings.get_string_from_id(me.getValue()) -               ); -         } -      } - -      System.out.println(pp_content); - -      return true; -   } -}  | 


