summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-08-03 15:28:17 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-08-03 15:28:17 +0200
commit90bb7e959496c3a12bebe055f6344b9f06f22809 (patch)
tree6635decc697d91c8cba6da9db8959b706ad9842f /cfg-to-paths/src/ControlFlow.java
parentc5a23ef9d6ab1e89b85016831fc8b2431f68f87f (diff)
Improving clarity through better Makefiles.
Diffstat (limited to 'cfg-to-paths/src/ControlFlow.java')
-rw-r--r--cfg-to-paths/src/ControlFlow.java142
1 files changed, 0 insertions, 142 deletions
diff --git a/cfg-to-paths/src/ControlFlow.java b/cfg-to-paths/src/ControlFlow.java
deleted file mode 100644
index 93d20ba..0000000
--- a/cfg-to-paths/src/ControlFlow.java
+++ /dev/null
@@ -1,142 +0,0 @@
-import java.io.*;
-
-public class ControlFlow
-{
- public static boolean load_file
- (
- final String filename
- )
- throws FileNotFoundException
- {
- final QuickParser qp;
- String[] input;
- boolean success;
-
- qp = new QuickParser(filename);
-
- for (;;)
- {
- try
- {
- input = qp.parse_line();
-
- if (input == null)
- {
- qp.finalize();
-
- return false;
- }
- else if (input.length == 0)
- {
- qp.finalize();
-
- break;
- }
- }
- catch (final IOException e)
- {
- System.err.println
- (
- "[E] IO error while parsing file \""
- + filename
- + "\":"
- /* FIXME: can be null */
- + e.getMessage()
- );
-
- return false;
- }
-
- if (input[0].equals("add_element"))
- {
- success = handle_add_element(input);
- }
- else if (input[0].equals("node_connect"))
- {
- success = handle_add_connect_to(input);
- }
- else if (input[0].equals("is_terminal"))
- {
- success = handle_is_terminal(input);
- }
- else
- {
- continue;
- }
-
- if (!success)
- {
- System.err.println
- (
- "[E] An erroneous instruction was found in file \""
- + filename
- + "\"."
- );
-
- try
- {
- qp.finalize();
- }
- catch (final Exception e)
- {
- System.err.println("[E] Additionally:");
- e.printStackTrace();
- }
-
- return false;
- }
- }
-
- return true;
- }
-
- private static boolean handle_add_element
- (
- final String[] input
- )
- {
- if (input.length != 3)
- {
- return false;
- }
-
- if (!input[1].equals("node"))
- {
- return true;
- }
-
- Node.handle_add_node(input[2]);
-
- return true;
- }
-
- private static boolean handle_is_terminal
- (
- final String[] input
- )
- {
- if (input.length != 2)
- {
- return false;
- }
-
- Node.handle_is_terminal(input[1]);
-
- return true;
- }
-
- private static boolean handle_add_connect_to
- (
- final String[] input
- )
- {
- if ((input.length != 3))
- {
- return false;
- }
-
- return Node.handle_connect_to(input[1], input[2]);
- }
-
- private ControlFlow () {} /* Utility Class */
-}