From 90bb7e959496c3a12bebe055f6344b9f06f22809 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Thu, 3 Aug 2017 15:28:17 +0200 Subject: Improving clarity through better Makefiles. --- cfg-to-paths/src/Main.java | 114 --------------------------------------------- 1 file changed, 114 deletions(-) delete mode 100644 cfg-to-paths/src/Main.java (limited to 'cfg-to-paths/src/Main.java') diff --git a/cfg-to-paths/src/Main.java b/cfg-to-paths/src/Main.java deleted file mode 100644 index d5cc650..0000000 --- a/cfg-to-paths/src/Main.java +++ /dev/null @@ -1,114 +0,0 @@ -/* FIXME: Finer imports */ -import java.util.*; - -import java.io.*; - -public class Main -{ - private static Parameters PARAMETERS; - private static int path_counter = 0; - - public static void main (final String... args) - { - final FileWriter output; - final Collection all_paths; - final Collection> all_subpaths; - - PARAMETERS = new Parameters(args); - - if (!PARAMETERS.are_valid()) - { - return; - } - - try - { - ControlFlow.load_file(PARAMETERS.get_model_file()); - } - catch (final Exception e) - { - System.err.println - ( - "[E] Could not load model file \"" - + PARAMETERS.get_model_file() - + "\":" - ); - - e.printStackTrace(); - - return; - } - - all_paths = Path.get_all_paths_from(PARAMETERS.get_root_node()); - - all_subpaths = new ArrayList>(); - - for (final Path p: all_paths) - { - all_subpaths.addAll(p.get_all_subpaths()); - } - - try - { - output = new FileWriter(PARAMETERS.get_output_file()); - - for (final List tuple: all_subpaths) - { - node_tuple_to_predicates(tuple, output); - } - - output.close(); - } - catch (final Exception e) - { - System.err.println - ( - "[E] Could not write to output file \"" - + PARAMETERS.get_model_file() - + "\":" - ); - - e.printStackTrace(); - - return; - } - } - - private static void node_tuple_to_predicates - ( - final List tuple, - final FileWriter out - ) - throws IOException - { - final String id; - final int tuple_size; - - tuple_size = tuple.size(); - - id = (PARAMETERS.get_id_prefix() + path_counter); - path_counter += 1; - - out.write("(add_element path " + id + ")\n"); - out.write("(is_path_of " + id + " " + tuple.get(0) + ")\n"); - - for (int i = 0; i < tuple_size; ++i) - { - out.write("(contains_node " + id + " " + tuple.get(i) + ")\n"); - - for (int j = (i + 1); j < tuple_size; ++j) - { - out.write - ( - "(is_before " - + id - + " " - + tuple.get(i) - + " " - + tuple.get(j) - + ")\n" - ); - } - } - } -} -- cgit v1.2.3-70-g09d2