| summaryrefslogtreecommitdiff |
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-07-22 21:05:57 +0200 |
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-07-22 21:05:57 +0200 |
| commit | 2b3f20d89c7d500842869d3316bee9c7457ba6d4 (patch) | |
| tree | b0429993666b252748e4c22bc230a5beaea1c3c6 /cfg-to-paths/src/Path.java | |
| parent | d05bd3592050a9496dd87bcd8a49f8fdc8b6b58d (diff) | |
Adds the "is_terminal" predicate.
Diffstat (limited to 'cfg-to-paths/src/Path.java')
| -rw-r--r-- | cfg-to-paths/src/Path.java | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/cfg-to-paths/src/Path.java b/cfg-to-paths/src/Path.java index 76ba28a..6015d53 100644 --- a/cfg-to-paths/src/Path.java +++ b/cfg-to-paths/src/Path.java @@ -5,28 +5,6 @@ public class Path private final ArrayList<Node> nodes; private final Node last_node; - private Path (final Node start) - { - nodes = new ArrayList<Node>(); - - nodes.add(start); - - last_node = start; - } - - private Path (final ArrayList<Node> nodes, final Node last_node) - { - this.nodes = nodes; - this.last_node = last_node; - - this.nodes.add(last_node); - } - - private Path add_step (final Node n) - { - return new Path((ArrayList<Node>) nodes.clone(), n); - } - public static Collection<Path> get_all_paths_from (final String root) { final Collection<Path> result; @@ -68,6 +46,10 @@ public class Path } else { + if (current_node.is_terminal()) + { + result.add(current_path); + } for (final Node next: next_nodes) { waiting_list.push(current_path.add_step(next)); @@ -78,6 +60,28 @@ public class Path return result; } + private Path (final Node start) + { + nodes = new ArrayList<Node>(); + + nodes.add(start); + + last_node = start; + } + + private Path (final ArrayList<Node> nodes, final Node last_node) + { + this.nodes = nodes; + this.last_node = last_node; + + this.nodes.add(last_node); + } + + private Path add_step (final Node n) + { + return new Path((ArrayList<Node>) nodes.clone(), n); + } + public Collection<List<Node>> get_all_subpaths () { final Collection<List<Node>> result; |


