updates to the <package>_<class name> identifier convention for class. Tests up...
authorThomas Walker Lynch <xtujpz@reasoningtechnology.com>
Fri, 8 Nov 2024 15:55:55 +0000 (15:55 +0000)
committerThomas Walker Lynch <xtujpz@reasoningtechnology.com>
Fri, 8 Nov 2024 15:55:55 +0000 (15:55 +0000)
96 files changed:
developer/document/GraphDirectedAcyclic_1.txt [new file with mode: 0644]
developer/javac/Ariadne_File.java [new file with mode: 0644]
developer/javac/Ariadne_Graph.java [new file with mode: 0644]
developer/javac/Ariadne_GraphDirectedAcyclic.java [new file with mode: 0644]
developer/javac/Ariadne_Label.java [new file with mode: 0644]
developer/javac/Ariadne_LabelList.java [new file with mode: 0644]
developer/javac/Ariadne_Node.java [new file with mode: 0644]
developer/javac/Ariadne_NodeList.java [new file with mode: 0644]
developer/javac/Ariadne_Production.java [new file with mode: 0644]
developer/javac/Ariadne_ProductionList.java [new file with mode: 0644]
developer/javac/Ariadne_Token.java [new file with mode: 0644]
developer/javac/Ariadne_TokenSet.java [new file with mode: 0644]
developer/javac/Ariadne_Util.java [new file with mode: 0644]
developer/javac/File.java [deleted file]
developer/javac/Graph.java [deleted file]
developer/javac/GraphDirectedAcyclic.java [deleted file]
developer/javac/Label.java [deleted file]
developer/javac/LabelList.java [deleted file]
developer/javac/Node.java [deleted file]
developer/javac/NodeList.java [deleted file]
developer/javac/Production.java [deleted file]
developer/javac/ProductionList.java [deleted file]
developer/javac/Token.java [deleted file]
developer/javac/TokenSet.java [deleted file]
developer/javac/Util.java [deleted file]
developer/scratch_pad/.gitignore [deleted file]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_File.class [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Graph.class [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_GraphDirectedAcyclic$1.class [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_GraphDirectedAcyclic$2.class [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_GraphDirectedAcyclic.class [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Label.class [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_LabelList.class [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Node.class [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_NodeList.class [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Production.class [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_ProductionList.class [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Token.class [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_TokenSet.class [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Util.class [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/File.java [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Graph.java [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/GraphDirectedAcyclic.java [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Label.java [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/LabelList.java [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Node.java [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/NodeList.java [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Production.java [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/ProductionList.java [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Token.java [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/TokenSet.java [new file with mode: 0644]
developer/scratchpad/com/ReasoningTechnology/Ariadne/Util.java [new file with mode: 0644]
developer/tool/distribute_source
release/Ariadne.jar
tester/deprecated/Test_File_0.java [new file with mode: 0644]
tester/deprecated/Test_Graph_0.java [new file with mode: 0644]
tester/deprecated/scratch_pad/.gitignore [new file with mode: 0644]
tester/javac/#Test2.javax#
tester/javac/#Test_Node_0.java# [deleted file]
tester/javac/In.java [deleted file]
tester/javac/TestMosaicUtil.java [deleted file]
tester/javac/Test_File_0.java
tester/javac/Test_Graph_0.java
tester/javac/Test_LabelList_0.java
tester/javac/Test_Label_0.java
tester/javac/Test_NodeList_0.java
tester/javac/Test_Node_0.java
tester/javac/Test_TokenSet_0.java
tester/javac/Test_Token_0.java
tester/javac/Test_Util_0.java
tester/jvm/Test_Ariadne.jar
tester/scratch_pad/.gitignore [deleted file]
tester/scratchpad/In$MIO.class [deleted file]
tester/scratchpad/In$MU.class [deleted file]
tester/scratchpad/In$TB.class [deleted file]
tester/scratchpad/In$TestBench.class [deleted file]
tester/scratchpad/In.class [deleted file]
tester/scratchpad/MU.class [deleted file]
tester/scratchpad/Test_File_0$TestSuite.class
tester/scratchpad/Test_File_0.class
tester/scratchpad/Test_Graph_0$TestSuite.class
tester/scratchpad/Test_Graph_0.class
tester/scratchpad/Test_LabelList_0$TestSuite.class
tester/scratchpad/Test_LabelList_0.class
tester/scratchpad/Test_Label_0$TestSuite.class
tester/scratchpad/Test_Label_0.class
tester/scratchpad/Test_NodeList_0$TestSuite.class
tester/scratchpad/Test_NodeList_0.class
tester/scratchpad/Test_Node_0$TestSuite.class
tester/scratchpad/Test_Node_0.class
tester/scratchpad/Test_TokenSet_0$TestSuite.class
tester/scratchpad/Test_TokenSet_0.class
tester/scratchpad/Test_Token_0$TestSuite.class
tester/scratchpad/Test_Token_0.class
tester/scratchpad/Test_Util_0$TestSuite.class
tester/scratchpad/Test_Util_0.class

diff --git a/developer/document/GraphDirectedAcyclic_1.txt b/developer/document/GraphDirectedAcyclic_1.txt
new file mode 100644 (file)
index 0000000..7a202e2
--- /dev/null
@@ -0,0 +1,84 @@
+  /*--------------------------------------------------------------------------------
+    Interface
+
+    1. nodes are referenced by label.
+
+    2. A list is a kind of sequence. It consists of a leftmost item, subsequent
+    items, and a rightmost item.
+
+    3. A node list consists of a leftmost node, subsequent nodes, and a rightmost node.
+
+    4. `path_stack`
+        
+        The `path_stack` is a list. Each item in the stack is a node list.
+
+        The rightmost items is the top of the stack.
+
+        The leftmost item is a list of root nodes, where traversal of the graph
+        starts.
+
+        Given two adjacent items on the path stack, say e0 and e1:
+
+            Say k0 is the leftmost node on the node list e0.
+            
+            The e1 will be the neighbor (child) list from node k0.
+
+            Hence, the path stack consists of the child lists of nodes along
+            a traversal. We chose a leftmost traversal.
+
+                e0:   k_0       k_1    ... k_2  
+
+                e1:   k_0_0    k_0_1   ... k_0_2   ; children of k_0
+
+                e2:   K_0_0_0  k_0_0_1 ... k_0_0_2 ; children of k_0_0
+                
+
+    5. `path`
+
+        A list of the leftmost nodes from a path stack.  
+
+        Given that e0 is a root node, `path` will consist of 
+
+            k_0, k_0_0, k_0_0_0 ... k_0_0..._0
+
+        Within the context of a path, k_0 is the leftmost item, and k_n is the
+        rightmost item.
+
+
+    6. removing a cycle
+
+       This is a build tool. Each node corresponds to a build objective, and the
+       neighbor nodes are dependencies. A neighbor node is a child node in our
+       tree descent, and is a dependency to our build tool.
+
+       This routine is called as part of the analysis phase. Nothing is
+       built here, rather we are merely marking dependency cycles that we
+       find when descending from the root nodes.
+
+       When we find a cycle, we remove those nodes from the current traversal
+       path, because we do not went the analysis to do in circles.  It is
+       possible that there are spurs that emanate from the cycle, and following
+       these might lead to finding more cycles.
+
+       Our build tool (which is not in this file) will stop descending through
+       the graph upon finding a cycle, and the effects of this will cause
+       upstream nodes to also not be built. Hence, the cycles hidden behind
+       other cycles are irrelevant.  
+
+       However, if we want to make routine of more general use, then the
+       discovered cycles should be pushed on to a cycle stack, and then each
+       item on the cycle stack would be used as root nodes for a new cycle
+       search. Note the leftmost cycle on each recursive search on the leftmost
+       node, will be the original cycle.
+  */
+
+  /*
+    Given a path to a node in the graph, `left_path`.
+
+    Checks if the rightmost node (referenced by label) recurs earlier in the path.
+    Presumably the rightmost node has been recently appended to the path.
+
+    If there is no cycle, returns null, otherwise returns the interval [i ,n],
+    of indexes into the path where the cycle is found. `n` will always be
+    the index of the rightmost node in the path list.
+  */
diff --git a/developer/javac/Ariadne_File.java b/developer/javac/Ariadne_File.java
new file mode 100644 (file)
index 0000000..825b499
--- /dev/null
@@ -0,0 +1,76 @@
+package com.ReasoningTechnology.Ariadne;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Ariadne_File {
+  static boolean debug = false;
+
+  public static Map<String, String> unpack_file_path(String file_fp) {
+    if (debug) System.out.println("unpack_file_path::file_fp: " + file_fp);
+
+    // Use java.io.File explicitly to avoid conflict with the custom Ariadne_File class
+    java.io.File file = new java.io.File(file_fp);
+    String parent_dp = (file.getParent() != null) ? file.getParent() : "";
+
+    if (!parent_dp.isEmpty() && !parent_dp.endsWith(java.io.File.separator)) {
+      parent_dp += java.io.File.separator;
+    }
+
+    String file_fn = file.getName();
+    String file_fn_base = file_fn;
+    String file_fn_ext = "";
+
+    int last_index = file_fn.lastIndexOf('.');
+    if (last_index > 0) {
+      file_fn_base = file_fn.substring(0, last_index);
+      if (last_index + 1 < file_fn.length()) {
+        file_fn_ext = file_fn.substring(last_index + 1);
+      }
+    }
+
+    Map<String, String> ret_val = new HashMap<>();
+    ret_val.put("dp", parent_dp);
+    ret_val.put("fn", file_fn);
+    ret_val.put("fn_base", file_fn_base);
+    ret_val.put("fn_ext", file_fn_ext);
+
+    if (debug) System.out.println("unpack_file_path::ret_val: " + ret_val);
+
+    return ret_val;
+  }
+
+  public static boolean file_exists_q(String fp_string) {
+    Path fp_object = Paths.get(fp_string);
+    return Files.exists(fp_object);
+  }
+
+  /*
+    Given a target_fp and a list of dependency_fp.
+
+    Returns false if the target is newer than all dependencies or if a file is missing;
+    otherwise, returns true.
+  */
+  public static boolean newer_than_all(String target_fp_string, List<String> dependency_fp_list) throws IOException {
+    Path target_fp_object = Paths.get(target_fp_string);
+    if (!Files.exists(target_fp_object)) return false;
+
+    long target_last_modified_time = Files.getLastModifiedTime(target_fp_object).toMillis();
+
+    return dependency_fp_list.stream().allMatch(dependency_fp -> {
+      try {
+        Path dependency_fp_object = Paths.get(dependency_fp);
+        if (!Files.exists(dependency_fp_object)) return false;
+        long dependency_last_modified_time = Files.getLastModifiedTime(dependency_fp_object).toMillis();
+        return target_last_modified_time > dependency_last_modified_time;
+      } catch (IOException e) {
+        return false;
+      }
+    });
+  }
+}
diff --git a/developer/javac/Ariadne_Graph.java b/developer/javac/Ariadne_Graph.java
new file mode 100644 (file)
index 0000000..2dd28b6
--- /dev/null
@@ -0,0 +1,62 @@
+package com.ReasoningTechnology.Ariadne;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Ariadne_Graph {
+
+  /*--------------------------------------------------------------------------------
+    constructors
+  */
+
+  public Ariadne_Graph(Map<Ariadne_Label, Ariadne_Node> node_map, Ariadne_ProductionList recognizer_f_list) {
+    if (node_map == null && recognizer_f_list == null) {
+      System.err.println("Ariadne_Graph: At least one of 'node_map' (Map) or 'recognizer_f_list' (List) must be provided.");
+      System.exit(1);
+    }
+
+    // Initialize each of node_map and recognizer_f_list to empty collections if null
+    this.node_map = (node_map != null) ? node_map : new HashMap<>();
+    this.recognizer_f_list = (recognizer_f_list != null) ? recognizer_f_list : new Ariadne_ProductionList();
+  }
+
+  /*--------------------------------------------------------------------------------
+   instance data 
+  */
+
+  private static boolean debug = true;
+  private Map<Ariadne_Label, Ariadne_Node> node_map;
+  private Ariadne_ProductionList recognizer_f_list;
+
+  /*--------------------------------------------------------------------------------
+   interface
+  */
+
+  // Lookup method to find a node by its label
+  public Ariadne_Node lookup(Ariadne_Label node_label, boolean verbose) {
+    if (node_label == null || node_label.isEmpty()) {
+      if (verbose) {
+        System.out.println("lookup:: given node_label is null or empty.");
+      }
+      return null;
+    }
+
+    // Try to retrieve the node from the map
+    Ariadne_Node node = this.node_map.get(node_label);
+
+    if (verbose) {
+      if (node != null) {
+        System.out.println("lookup:: found node: " + node);
+      } else {
+        System.out.println("lookup:: node not found for label: " + node_label);
+      }
+    }
+
+    return node;
+  }
+
+  // Overloaded lookup method with default verbosity (true)
+  public Ariadne_Node lookup(Ariadne_Label node_label) {
+    return lookup(node_label, true);
+  }
+}
diff --git a/developer/javac/Ariadne_GraphDirectedAcyclic.java b/developer/javac/Ariadne_GraphDirectedAcyclic.java
new file mode 100644 (file)
index 0000000..3a8e9e2
--- /dev/null
@@ -0,0 +1,214 @@
+package com.ReasoningTechnology.Ariadne;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+
+public class Ariadne_GraphDirectedAcyclic extends Ariadne_Graph {
+
+  /*--------------------------------------------------------------------------------
+    Constructors
+  */
+
+  public Ariadne_GraphDirectedAcyclic(Map<Ariadne_Label, Ariadne_Node> node_map, Ariadne_ProductionList recognizer_f_list, Ariadne_LabelList root_node_list, int max_depth, boolean verbose) {
+    super(node_map, recognizer_f_list);
+    Ariadne_TokenSet cycle_detection_result = graph_mark_cycles(root_node_list, max_depth, verbose);
+  }
+
+  public Ariadne_GraphDirectedAcyclic(Map<Ariadne_Label, Ariadne_Node> node_map, Ariadne_ProductionList recognizer_f_list, Ariadne_LabelList root_node_list) {
+    super(node_map, recognizer_f_list);
+    Ariadne_TokenSet cycle_detection_result = graph_mark_cycles(root_node_list);
+  }
+
+  /*--------------------------------------------------------------------------------
+    Instance Data Extension
+  */
+
+  private static boolean debug = true;
+
+  /*--------------------------------------------------------------------------------
+    Interface
+  */
+
+  private List<Integer> path_find_cycle(Ariadne_LabelList path) {
+    if (path.size() <= 1) return null;
+
+    int rightmost_index = path.size() - 1;
+    Ariadne_Label rightmost_node_label = path.get(rightmost_index);
+
+    int cycle_leftmost_index = path.indexOf(rightmost_node_label);
+    Boolean has_cycle = cycle_leftmost_index < rightmost_index;
+    if (!has_cycle) return null;
+
+    List<Integer> result = new ArrayList<>();
+    result.add(cycle_leftmost_index);
+    result.add(rightmost_index);
+    return result;
+  }
+
+  private boolean graph_descend_cycle_case(Ariadne_LabelList left_path, List<Ariadne_LabelList> path_stack, boolean verbose) {
+
+    List<Integer> cycle_index_interval = path_find_cycle(left_path);
+    if (cycle_index_interval == null) {
+      return false;
+    }
+
+    int cycle_i0 = cycle_index_interval.get(0);
+    int cycle_n = cycle_index_interval.get(1);
+
+    if (verbose) Ariadne_Util.print_list(
+      "Found cycle:", 
+      left_path.subList(cycle_i0, cycle_n + 1)
+    );
+
+    Ariadne_LabelList undefined_node_list = new Ariadne_LabelList();
+    for (int i = cycle_i0; i <= cycle_n; i++) {
+      Ariadne_Label node_label = left_path.get(i);
+      Ariadne_Node node = super.lookup(node_label);
+      if (node != null) {
+        node.mark(new Ariadne_Token("cycle_member"));
+      } else {
+        undefined_node_list.add(node_label);
+      }
+    }
+
+    if (verbose) Ariadne_Util.print_list(
+      "Each undefined node could not be marked as a cycle member:", 
+      undefined_node_list
+    );
+
+    path_stack.subList(cycle_i0 + 1, cycle_n + 1).clear();
+
+    return true;
+  }
+
+  private static Ariadne_TokenSet graph_descend_set = new Ariadne_TokenSet() {{
+    add(new Ariadne_Token("empty_path_stack"));
+    add(new Ariadne_Token("cycle_found"));
+    add(new Ariadne_Token("undefined_node"));
+    add(new Ariadne_Token("leaf"));
+    add(new Ariadne_Token("max_depth_reached"));
+  }};
+
+  private Ariadne_TokenSet graph_descend(List<Ariadne_LabelList> path_stack, int max_depth, boolean verbose) {
+    Ariadne_TokenSet ret_value = new Ariadne_TokenSet();
+
+    if (path_stack.isEmpty()) {
+      ret_value.add(new Ariadne_Token("empty_path_stack"));
+      return ret_value;
+    }
+
+    Ariadne_LabelList left_path = new Ariadne_LabelList();
+    for (Ariadne_LabelList neighbor_list : path_stack) {
+      left_path.add(neighbor_list.get(0));
+    }
+
+    do {
+
+      if (graph_descend_cycle_case(left_path, path_stack, verbose)) {
+        ret_value.add(new Ariadne_Token("cycle_found"));
+        return ret_value;
+      }
+
+      Ariadne_Label it_node_label = path_stack.get(path_stack.size() - 1).get(0);
+      Ariadne_Node it_node = super.lookup(it_node_label);
+      if (it_node == null) {
+        ret_value.add(new Ariadne_Token("undefined_node"));
+        return ret_value;
+      }
+        
+      Ariadne_LabelList neighbor_list = it_node.neighbor_LabelList();
+      if (neighbor_list.isEmpty()) {
+        ret_value.add(new Ariadne_Token("leaf"));
+        return ret_value;
+      }
+
+      path_stack.add(new Ariadne_LabelList(neighbor_list));
+      Ariadne_Label it_next_label = neighbor_list.get(0);
+      left_path.add(it_next_label);
+
+      if (max_depth > 0) {
+        max_depth--;
+        if (max_depth == 0) {
+          if (verbose) {
+            Ariadne_Util.print_list("GraphDirectedAcyclic.GraphDescend:: max_depth reached, ending descent:", path_stack);
+          }
+          ret_value.add(new Ariadne_Token("max_depth_reached"));
+          return ret_value;
+        }
+      }
+
+    } while (true);
+  }
+
+  public static Ariadne_TokenSet graph_mark_cycles_set = new Ariadne_TokenSet() {{
+    add(new Ariadne_Token("empty_root_label_list"));
+    add(new Ariadne_Token("cycle_exists"));
+    add(new Ariadne_Token("undefined_node_exists"));
+    add(new Ariadne_Token("bad_descent_termination"));
+    add(new Ariadne_Token("max_depth_reached"));
+  }};
+
+  public Ariadne_TokenSet graph_mark_cycles(Ariadne_LabelList root_node_LabelList, int max_depth, boolean verbose) {
+    Ariadne_TokenSet ret_value = new Ariadne_TokenSet();
+    boolean exists_malformed = false;
+    Ariadne_TokenSet result;
+
+    if (root_node_LabelList.isEmpty()) {
+      ret_value.add(new Ariadne_Token("empty_root_label_list"));
+      return ret_value;
+    }
+
+    List<Ariadne_LabelList> path_stack = new ArrayList<>();
+    path_stack.add(new Ariadne_LabelList(root_node_LabelList));
+
+    do {
+      result = graph_descend(path_stack, max_depth, verbose);
+      if (result.contains(new Ariadne_Token("cycle_found"))) ret_value.add(new Ariadne_Token("cycle_exists"));
+      if (result.contains(new Ariadne_Token("undefined_node"))) ret_value.add(new Ariadne_Token("undefined_node_exists"));
+      if (result.contains(new Ariadne_Token("max_depth_reached"))) ret_value.add(new Ariadne_Token("max_depth_reached"));
+      if (!result.contains(new Ariadne_Token("leaf")) && !result.contains(new Ariadne_Token("cycle_found"))) ret_value.add(new Ariadne_Token("bad_descent_termination"));
+
+      Ariadne_LabelList top_list = path_stack.get(path_stack.size() - 1);
+      top_list.remove(0);
+      if (top_list.isEmpty()) path_stack.remove(path_stack.size() - 1);
+
+    } while (!path_stack.isEmpty());
+
+    if (verbose) {
+      if (ret_value.contains("bad_descent_termination")) {
+        System.out.println("GraphDirectedAcyclic.graph_mark_cycles:: terminated with unexpected condition.");
+      }
+      if (ret_value.contains("cycle_exists")) {
+        System.out.println("GraphDirectedAcyclic.graph_mark_cycles:: One or more cycles detected.");
+      }
+      if (ret_value.contains("undefined_node_exists")) {
+        System.out.println("GraphDirectedAcyclic.graph_mark_cycles:: Undefined nodes exist.");
+      }
+    }
+
+    return ret_value;
+  }
+
+  public Ariadne_TokenSet graph_mark_cycles(Ariadne_LabelList root_node_LabelList) {
+    return graph_mark_cycles(root_node_LabelList, this.debug ? 40 : -1, this.debug);
+  }
+
+  @Override
+  public Ariadne_Node lookup(Ariadne_Label node_label, boolean verbose) {
+    Ariadne_Node node = super.lookup(node_label, verbose);
+    if (node != null && node.has_mark(new Ariadne_Token("cycle_member"))) {
+      if (verbose) {
+        System.out.println("GraphDirectedAcyclic.lookup:: Node is part of a cycle, not returned: " + node_label);
+      }
+      return null;
+    }
+    return node;
+  }
+
+  public Ariadne_Node lookup(Ariadne_Label node_label) {
+    return lookup(node_label, this.debug);
+  }
+
+}
diff --git a/developer/javac/Ariadne_Label.java b/developer/javac/Ariadne_Label.java
new file mode 100644 (file)
index 0000000..9f10fcb
--- /dev/null
@@ -0,0 +1,42 @@
+package com.ReasoningTechnology.Ariadne;
+
+/*
+  A value for the node.label property.
+
+  This is a wrapper for a String. We can't instead use an alias by extending
+  String, because String is a JavaScript 'final' type.
+
+*/
+public class Ariadne_Label{
+  private final String value;
+
+  public Ariadne_Label(String value){
+    this.value = value;
+  }
+
+  public boolean isEmpty(){
+    return value.isEmpty();
+  }
+
+  public String get(){
+    return value;
+  }
+
+  @Override
+  public String toString(){
+    return value;
+  }
+
+  @Override
+  public boolean equals(Object o){
+    if(this == o) return true;
+    if( o == null || getClass() != o.getClass() ) return false;
+    Ariadne_Label label = (Ariadne_Label)o;
+    return value.equals( label.value );
+  }
+
+  @Override
+  public int hashCode(){
+    return value.hashCode();
+  }
+}
diff --git a/developer/javac/Ariadne_LabelList.java b/developer/javac/Ariadne_LabelList.java
new file mode 100644 (file)
index 0000000..ae2dd0b
--- /dev/null
@@ -0,0 +1,18 @@
+// LabelList.java
+package com.ReasoningTechnology.Ariadne;
+import java.util.List; 
+import java.util.ArrayList;
+
+public class Ariadne_LabelList extends ArrayList<Ariadne_Label>{
+  // Constructor
+  public Ariadne_LabelList(){
+    super();
+  }
+  public Ariadne_LabelList(List<Ariadne_Label> labels){
+    super();  // Initialize the parent class
+    if(labels != null){
+      this.addAll(labels);  // Copy all elements from the provided list
+    }
+  }
+
+}
diff --git a/developer/javac/Ariadne_Node.java b/developer/javac/Ariadne_Node.java
new file mode 100644 (file)
index 0000000..41d8ccd
--- /dev/null
@@ -0,0 +1,30 @@
+package com.ReasoningTechnology.Ariadne;
+import java.util.HashMap;
+
+public class Ariadne_Node extends HashMap<String, Object> {
+
+  private static String mark_property_name = "mark";
+  private static String neighbor_property_name = "neighbor";
+
+  public Ariadne_Node() {
+    super();
+    this.put(neighbor_property_name, new Ariadne_LabelList());
+  }
+
+  public void mark(Ariadne_Token token) {
+    if (this.get(mark_property_name) == null) {
+      this.put(mark_property_name, new Ariadne_TokenSet());
+    }
+    ((Ariadne_TokenSet) this.get(mark_property_name)).add(token);
+  }
+
+  public boolean has_mark(Ariadne_Token token) {
+    Ariadne_TokenSet mark = (Ariadne_TokenSet) this.get(mark_property_name);
+    return mark != null && mark.contains(token);
+  }
+
+  public Ariadne_LabelList neighbor_LabelList() {
+    return (Ariadne_LabelList) this.get(neighbor_property_name);
+  }
+
+}
diff --git a/developer/javac/Ariadne_NodeList.java b/developer/javac/Ariadne_NodeList.java
new file mode 100644 (file)
index 0000000..69e4284
--- /dev/null
@@ -0,0 +1,10 @@
+// NodeList.java
+package com.ReasoningTechnology.Ariadne;
+import java.util.ArrayList;
+
+public class Ariadne_NodeList extends ArrayList<Ariadne_Node> {
+  // Constructor
+  public Ariadne_NodeList(){
+    super();
+  }
+}
diff --git a/developer/javac/Ariadne_Production.java b/developer/javac/Ariadne_Production.java
new file mode 100644 (file)
index 0000000..ab6aed9
--- /dev/null
@@ -0,0 +1,5 @@
+// Production.java
+package com.ReasoningTechnology.Ariadne;
+import java.util.function.Function;
+
+public interface Ariadne_Production extends Function<Ariadne_Label, Ariadne_Node> {}
diff --git a/developer/javac/Ariadne_ProductionList.java b/developer/javac/Ariadne_ProductionList.java
new file mode 100644 (file)
index 0000000..03b2461
--- /dev/null
@@ -0,0 +1,10 @@
+// ProductionList.java
+package com.ReasoningTechnology.Ariadne;
+import java.util.ArrayList;
+
+public class Ariadne_ProductionList extends ArrayList<Ariadne_Production> {
+  // Constructor
+  public Ariadne_ProductionList(){
+    super();
+  }
+}
diff --git a/developer/javac/Ariadne_Token.java b/developer/javac/Ariadne_Token.java
new file mode 100644 (file)
index 0000000..98e3863
--- /dev/null
@@ -0,0 +1,35 @@
+package com.ReasoningTechnology.Ariadne;
+
+/*
+An error token.
+
+*/
+public class Ariadne_Token {
+  private final String value;
+
+  public Ariadne_Token(String value){
+    this.value = value;
+  }
+
+  public String get(){
+    return value;
+  }
+
+  @Override
+  public String toString(){
+    return value;
+  }
+
+  @Override
+  public boolean equals(Object o){
+    if(this == o) return true;  // No padding, not nested
+    if( o == null || getClass() != o.getClass() ) return false;  // Padded, because it's nested
+    Ariadne_Token token = (Ariadne_Token)o;
+    return value.equals( token.value );
+  }
+
+  @Override
+  public int hashCode(){
+    return value.hashCode();
+  }
+}
diff --git a/developer/javac/Ariadne_TokenSet.java b/developer/javac/Ariadne_TokenSet.java
new file mode 100644 (file)
index 0000000..9ec671c
--- /dev/null
@@ -0,0 +1,10 @@
+// TokenSet.java
+package com.ReasoningTechnology.Ariadne;
+import java.util.HashSet;
+
+public class Ariadne_TokenSet extends HashSet<Ariadne_Token> {
+  // Constructor
+  public Ariadne_TokenSet(){
+    super();
+  }
+}
diff --git a/developer/javac/Ariadne_Util.java b/developer/javac/Ariadne_Util.java
new file mode 100644 (file)
index 0000000..28009b3
--- /dev/null
@@ -0,0 +1,25 @@
+package com.ReasoningTechnology.Ariadne;
+import java.util.List; 
+
+public class Ariadne_Util{
+  static boolean debug = false;
+
+  public static void print_list(String prefix ,List<?> item_list){
+    if( item_list == null || item_list.isEmpty() ){
+      return;
+    }
+    if( prefix != null && !prefix.isEmpty() ){
+      System.out.print(prefix);
+    }
+    int i = 0;
+    int n = item_list.size() - 1;
+    System.out.print( " '" + item_list.get(i) + "'" );
+    do{
+      i++;
+      if( i > n ) break;
+      System.out.print(", " +  "'" + item_list.get(i) + "'");
+    }while( true );
+    System.out.println(".");
+  }
+
+}
diff --git a/developer/javac/File.java b/developer/javac/File.java
deleted file mode 100644 (file)
index 4058dc7..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.ReasoningTechnology.Ariadne;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.List;
-import com.ReasoningTechnology.Mosaic.Mosaic_IO;
-
-public class File {
-  static boolean debug = false;
-
-  public static Map<String, String> unpack_file_path(String file_fp) {
-    if (debug) System.out.println("unpack_file_path::file_fp: " + file_fp);
-
-    // Use java.io.File explicitly to avoid conflict with the custom File class
-    java.io.File file = new java.io.File(file_fp);
-    String parent_dp = (file.getParent() != null) ? file.getParent() : "";
-
-    if (!parent_dp.isEmpty() && !parent_dp.endsWith(java.io.File.separator)) {
-      parent_dp += java.io.File.separator;
-    }
-
-    String file_fn = file.getName();
-    String file_fn_base = file_fn;
-    String file_fn_ext = "";
-
-    int last_index = file_fn.lastIndexOf('.');
-    if (last_index > 0) {
-      file_fn_base = file_fn.substring(0, last_index);
-      if (last_index + 1 < file_fn.length()) {
-        file_fn_ext = file_fn.substring(last_index + 1);
-      }
-    }
-
-    Map<String, String> ret_val = new HashMap<>();
-    ret_val.put("dp", parent_dp);
-    ret_val.put("fn", file_fn);
-    ret_val.put("fn_base", file_fn_base);
-    ret_val.put("fn_ext", file_fn_ext);
-
-    if (debug) System.out.println("unpack_file_path::ret_val: " + ret_val);
-
-    return ret_val;
-  }
-
-  public static boolean file_exists_q(String fp_string) {
-    Path fp_object = Paths.get(fp_string);
-    return Files.exists(fp_object);
-  }
-
-  /*
-    Given a target_fp and a list of list of dependency_fp.
-
-    Returns false if either the target is newer than all the dependencies, or one
-    of the specified files is missing. Otherwise returns true.
-  */
-  public static boolean newer_than_all(String target_fp_string, List<String> dependency_fp_list) throws IOException {
-    Path target_fp_object = Paths.get(target_fp_string);
-    if (!Files.exists(target_fp_object)) return false;
-
-    long target_last_modified_time = Files.getLastModifiedTime(target_fp_object).toMillis();
-
-    return dependency_fp_list.stream().allMatch(dependency_fp -> {
-      try {
-        Path dependency_fp_object = Paths.get(dependency_fp);
-        if (!Files.exists(dependency_fp_object)) return false;
-        long dependency_last_modified_time = Files.getLastModifiedTime(dependency_fp_object).toMillis();
-        return target_last_modified_time > dependency_last_modified_time;
-      } catch (IOException e) {
-        return false;
-      }
-    });
-  }
-
-}
diff --git a/developer/javac/Graph.java b/developer/javac/Graph.java
deleted file mode 100644 (file)
index d50c429..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.ReasoningTechnology.Ariadne;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class Graph{
-
-  /*--------------------------------------------------------------------------------
-    constructors
-  */
-
-  public Graph(Map<Label ,Node> node_map ,ProductionList recognizer_f_list){
-    if(node_map == null && recognizer_f_list == null){
-      System.err.println("AriadneGraph: At least one of 'node_map' (Map) or 'recognizer_f_list' (List) must be provided.");
-      System.exit(1);
-    }
-
-    // Initialize each of node_map and recognizer_f_list to empty collections if null
-    this.node_map = (node_map != null) ? node_map : new HashMap<Label ,Node>();
-    this.recognizer_f_list = (recognizer_f_list != null) ? recognizer_f_list : new ProductionList();
-  }
-
-  /*--------------------------------------------------------------------------------
-   instance data 
-  */
-
-  private static boolean debug = true;
-  private Map<Label ,Node> node_map;
-  private ProductionList recognizer_f_list;
-
-  /*--------------------------------------------------------------------------------
-   interface
-  */
-
-  // Lookup method to find a node by its label
-  public Node lookup(Label node_label ,boolean verbose){
-    if( node_label == null || node_label.isEmpty() ){
-      if(verbose){
-        System.out.println("lookup:: given node_label is null or empty.");
-      }
-      return null;
-    }
-
-    // Try to retrieve the node from the map
-    Node node = this.node_map.get(node_label);
-
-    if(verbose){
-      if(node != null){
-        System.out.println("lookup:: found node: " + node);
-      } else {
-        System.out.println("lookup:: node not found for label: " + node_label);
-      }
-    }
-
-    return node;
-  }
-
-  // Overloaded lookup method with default verbosity (true)
-  public Node lookup(Label node_label){
-    return lookup(node_label ,true);
-  }
-
-}
diff --git a/developer/javac/GraphDirectedAcyclic.java b/developer/javac/GraphDirectedAcyclic.java
deleted file mode 100644 (file)
index c71a2b9..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-package com.ReasoningTechnology.Ariadne;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.List;
-import java.util.ArrayList;
-
-public class GraphDirectedAcyclic extends Graph{
-
-  /*--------------------------------------------------------------------------------
-    constructors
-  */
-
-  public GraphDirectedAcyclic(Map<Label ,Node> node_map ,ProductionList recognizer_f_list ,LabelList root_node_list ,int max_depth ,boolean verbose){
-    super( node_map ,recognizer_f_list );
-    TokenSet cycle_detection_result = graph_mark_cycles(root_node_list ,max_depth ,verbose);
-  }
-
-  public GraphDirectedAcyclic(Map<Label ,Node> node_map ,ProductionList recognizer_f_list ,LabelList root_node_list){
-    super( node_map ,recognizer_f_list );
-    TokenSet cycle_detection_result = graph_mark_cycles(root_node_list);
-  }
-
-
-  /*--------------------------------------------------------------------------------
-   instance data extension
-  */
-
-  private static boolean debug = true;
-
-
-  /*--------------------------------------------------------------------------------
-    Interface
-
-    1. nodes are referenced by label.
-
-    2. A list is a kind of sequence. It consists of a leftmost item, subsequent
-    items, and a rightmost item.
-
-    3. A node list consists of a leftmost node, subsequent nodes, and a rightmost node.
-
-    4. `path_stack`
-        
-        The `path_stack` is a list. Each item in the stack is a node list.
-
-        The rightmost items is the top of the stack.
-
-        The leftmost item is a list of root nodes, where traversal of the graph
-        starts.
-
-        Given two adjacent items on the path stack, say e0 and e1:
-
-            Say k0 is the leftmost node on the node list e0.
-            
-            The e1 will be the neighbor (child) list from node k0.
-
-            Hence, the path stack consists of the child lists of nodes along
-            a traversal. We chose a leftmost traversal.
-
-                e0:   k_0       k_1    ... k_2  
-
-                e1:   k_0_0    k_0_1   ... k_0_2   ; children of k_0
-
-                e2:   K_0_0_0  k_0_0_1 ... k_0_0_2 ; children of k_0_0
-                
-
-    5. `path`
-
-        A list of the leftmost nodes from a path stack.  
-
-        Given that e0 is a root node, `path` will consist of 
-
-            k_0, k_0_0, k_0_0_0 ... k_0_0..._0
-
-        Within the context of a path, k_0 is the leftmost item, and k_n is the
-        rightmost item.
-
-
-    6. removing a cycle
-
-       This is a build tool. Each node corresponds to a build objective, and the
-       neighbor nodes are dependencies. A neighbor node is a child node in our
-       tree descent, and is a dependency to our build tool.
-
-       This routine is called as part of the analysis phase. Nothing is
-       built here, rather we are merely marking dependency cycles that we
-       find when descending from the root nodes.
-
-       When we find a cycle, we remove those nodes from the current traversal
-       path, because we do not went the analysis to do in circles.  It is
-       possible that there are spurs that emanate from the cycle, and following
-       these might lead to finding more cycles.
-
-       Our build tool (which is not in this file) will stop descending through
-       the graph upon finding a cycle, and the effects of this will cause
-       upstream nodes to also not be built. Hence, the cycles hidden behind
-       other cycles are irrelevant.  
-
-       However, if we want to make routine of more general use, then the
-       discovered cycles should be pushed on to a cycle stack, and then each
-       item on the cycle stack would be used as root nodes for a new cycle
-       search. Note the leftmost cycle on each recursive search on the leftmost
-       node, will be the original cycle.
-  */
-
-  /*
-    Given a path to a node in the graph, `left_path`.
-
-    Checks if the rightmost node (referenced by label) recurs earlier in the path.
-    Presumably the rightmost node has been recently appended to the path.
-
-    If there is no cycle, returns null, otherwise returns the interval [i ,n],
-    of indexes into the path where the cycle is found. `n` will always be
-    the index of the rightmost node in the path list.
-  */
-  private List<Integer>  path_find_cycle(LabelList path ){
-    if( path.size() <= 1 ) return null; 
-
-    int rightmost_index = path.size() - 1;
-    Label rightmost_node_label = path.get( rightmost_index );
-
-    // if there is no cycle, searching for rightmost_node_label will find itself:
-    int cycle_leftmost_index = path.indexOf(rightmost_node_label);
-    Boolean has_cycle = cycle_leftmost_index < rightmost_index;
-    if( ! has_cycle ) return null;
-
-    List<Integer> result = new ArrayList<>();
-    result.add(cycle_leftmost_index);
-    result.add(rightmost_index);
-    return result;
-  }
-
-  /*
-    Given a path_stack, which is our graph iterator.  Also given `left_path`
-    which is derived from path_stack, and represents the left most neighbor
-    of each of the neighbor lists in the path_stack.
-
-    Calls `path_find_cycle` to see if the most recently added to the path node,
-    i.e. the rightmost node, forms a cycle with other node(s) in the path.  Upon
-    finding a cycle, unwinds the path_stack (decrements the iterator), to the top
-    of the cycle.
-
-    If a cycle is found, returns false, otherwise returns true.
-  */
-  private boolean graph_descend_cycle_case( LabelList left_path ,List<LabelList> path_stack ,boolean verbose ){
-
-    List<Integer> cycle_index_interval = path_find_cycle(left_path);
-    if( cycle_index_interval == null ){
-      return false; // No cycle found
-    }
-
-    int cycle_i0 = cycle_index_interval.get(0); // Cycle leftmost, inclusive
-    int cycle_n = cycle_index_interval.get(1);  // Cycle rightmost, inclusive
-
-    if(verbose) Util.print_list(
-      "Found cycle:" 
-      ,left_path.subList( cycle_i0 ,cycle_n + 1)
-    );
-
-    // Mark cycle members
-    LabelList undefined_node_list = new LabelList();
-    for( int i = cycle_i0; i <= cycle_n; i++ ){
-      Label node_label = left_path.get(i);
-      Node node = super.lookup( node_label );
-      if (node != null){
-        node.mark(new Token("cycle_member"));
-      }else{
-        undefined_node_list.add( node_label );
-      }
-    }
-
-    if(verbose) Util.print_list(
-      "Each undefined node could not be marked as a cycle member:" 
-      ,undefined_node_list
-    );
-
-    // Reset the graph iterator to the top of the cycle
-    path_stack.subList( cycle_i0 + 1 ,cycle_n + 1 ).clear();
-
-    return true; // cycle found
-  }
-  
-  /*
-    Given a path_stack initialized to the root nodes for the graph traversal.
-
-    Perform depth first descent from each node in succession while searching for
-    cycles by calling graph_descent_cycle_case. Algorithm follows the leftmost
-    nodes in the path_stack list of child lists.
-
-    Returns the descent termination condition.
-  */
-  private static TokenSet graph_descend_set = new TokenSet() {{
-    add(new Token("empty_path_stack"));
-    add(new Token("cycle_found"));
-    add(new Token("undefined_node"));
-    add(new Token("leaf"));
-    add(new Token("max_depth_reached"));
-  }};
-  private TokenSet graph_descend( List<LabelList> path_stack ,int max_depth ,boolean verbose ){
-    TokenSet ret_value = new TokenSet();
-
-    if( path_stack.isEmpty() ){
-      ret_value.add( new Token("empty_path_stack") );
-      return ret_value;
-    }
-
-    // a leftmost path through the neighbor lists of the leftmost nodes
-    LabelList left_path = new LabelList();
-    for( LabelList neighbor_list : path_stack ){
-      left_path.add( neighbor_list.get(0) );
-    }
-
-    // do descend
-    do{
-
-      // cycle case
-      if( graph_descend_cycle_case( left_path ,path_stack ,verbose ) ){
-        ret_value.add( new Token("cycle_found") );
-        return ret_value;
-      }
-
-      // Non-cycle case, descend further into the tree.
-      // Increment the graph iterator (path_stack) to go down a level.
-      Label it_node_label = path_stack.get( path_stack.size() - 1 ).get(0);
-      Node it_node = super.lookup( it_node_label );
-      if( it_node == null ){
-        ret_value.add( new Token("undefined_node") );
-        return ret_value;
-      }
-        
-      LabelList neighbor_list = it_node.neighbor_LabelList();
-      if( neighbor_list.isEmpty() ){
-        ret_value.add( new Token("leaf") );
-        return ret_value;
-      }
-
-      // The iterator will destroy the neighbor_list as we traverse the graph,
-      // so we give it a copy.
-      path_stack.add( new LabelList(neighbor_list) );
-      Label it_next_label = neighbor_list.get(0);
-      left_path.add( it_next_label ); // also extend the left_path
-
-      // bound the size of problem we are willing to work on
-      // set max_depth <= 0 to have this test ignored
-      if( max_depth > 0 ){
-        max_depth--;  // Typo fixed
-        if( max_depth == 0 ){
-          if(verbose){
-            Util.print_list("GraphDirectedAcyclic.GraphDescend:: max_depth reached, preternaturally ending the descent:" ,path_stack);
-          }
-          ret_value.add( new Token("max_depth_reached") );
-          return ret_value;
-        }
-      }
-
-    }while(true); // while descend
-  }
-
-   
-  /*
-    Given root_node_label_list and a maximum depth for traversal.
-
-    Cycles are handled gracefully, rather the constraint `max_depth` is present
-    because the user is allowed to provide production *functions* for generating
-    nodes. Who knows what crazy graphs a user could come up with, see the
-    document on the algorithm for more info.
-  
-    Does a left first depth first traversal of the graph while marking
-    cycles. This routine pushes the graph traversal iterator to the right one
-    node after a left descent traversal, then it calls `graph_descend` descend
-    from said node.
-
-    Returns one or more symbols that characterize the termination condition.
-  */
-
-  public static TokenSet graph_mark_cycles_set = new TokenSet() {{
-    add(new Token("empty_root_label_list"));
-    add(new Token("cycle_exists"));
-    add(new Token("undefined_node_exists"));
-    add(new Token("bad_descent_termination"));
-    add(new Token("max_depth_reached"));
-  }};
-  public TokenSet graph_mark_cycles( LabelList root_node_LabelList ,int max_depth ,boolean verbose ){
-    TokenSet ret_value = new TokenSet();
-    boolean exists_malformed = false;
-    TokenSet result; // used variously
-
-    if( root_node_LabelList.isEmpty() ){
-      ret_value.add(new Token("empty_root_label_list"));
-      return ret_value;
-    }
-
-    // `path_stack` is our graph iterator. It is initialized with the
-    // `root_node_LabelList`.
-    List<LabelList> path_stack = new ArrayList<>();
-    path_stack.add( new LabelList(root_node_LabelList) );
-
-    // each call to graph_descend does a leftmost descent to a leaf
-    do{
-      result = graph_descend( path_stack ,max_depth ,verbose );
-      if( result.contains(new Token("cycle_found")) ) ret_value.add(new Token("cycle_exists"));
-      if( result.contains(new Token("undefined_node")) ) ret_value.add(new Token("undefined_node_exists"));
-      if( result.contains(new Token("max_depth_reached")) ) ret_value.add(new Token("max_depth_reached"));
-      if( !result.contains(new Token("leaf")) && !result.contains(new Token("cycle_found")) ) ret_value.add(new Token("bad_descent_termination"));
-
-      // Push the iterator to the right by one node
-      LabelList top_list = path_stack.get( path_stack.size() - 1 );
-      top_list.remove(0);
-      if( top_list.isEmpty() ) path_stack.remove( path_stack.size() - 1 );
-
-    }while( !path_stack.isEmpty() );
-
-    if(verbose){
-      if( ret_value.contains("bad_descent_termination") ){
-        System.out.println("GraphDirectedAcyclic.graph_mark_cycles:: graph_descend terminated with other than leaf or cycle found condition.");
-      }
-      if( ret_value.contains("cycle_exists") ){
-        System.out.println("GraphDirectedAcyclic.graph_mark_cycles:: There are one or more cycles in the graph.");
-      }
-      if( ret_value.contains("undefined_node_exists") ){
-        System.out.println("GraphDirectedAcyclic.graph_mark_cycles:: There are one or more node label references that do not correspond to a defined node in this graph.");
-      }
-    }
-
-    return ret_value;
-  }
-   public TokenSet graph_mark_cycles(LabelList root_node_LabelList){
-    return graph_mark_cycles(root_node_LabelList ,this.debug?40:-1 ,this.debug);
-  }
-  
-
-  /*--------------------------------------------------------------------------------
-    Graph traversal
-  */
-
-  @Override
-  public Node lookup(Label node_label, boolean verbose){
-    Node node = super.lookup(node_label, verbose);
-    if(node != null && node.has_mark(new Token("cycle_member"))){
-      if(verbose){
-        System.out.println("GraphDirectedAcyclic.lookup:: Node is part of a cycle so it will not be returned: " + node_label);
-      }
-      return null;  // Exclude nodes in cycles
-    }
-    return node;
-  }
-
-  public Node lookup(Label node_label){
-    return lookup(node_label ,this.debug);
-  }
-
-}
diff --git a/developer/javac/Label.java b/developer/javac/Label.java
deleted file mode 100644 (file)
index 3d13f45..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.ReasoningTechnology.Ariadne;
-
-/*
-  A value for the node.label property.
-
-  This is a wrapper for a String. We can't instead use an alias by extending
-  String, because String is a JavaScript 'final' type.
-
-*/
-public class Label {
-  private final String value;
-
-  public Label(String value){
-    this.value = value;
-  }
-
-  public boolean isEmpty() {
-    return value.isEmpty();
-  }
-
-  public String get(){
-    return value;
-  }
-
-  @Override
-  public String toString(){
-    return value;
-  }
-
-  @Override
-  public boolean equals(Object o){
-    if(this == o) return true;
-    if( o == null || getClass() != o.getClass() ) return false;
-    Label label = (Label)o;
-    return value.equals( label.value );
-  }
-
-  @Override
-  public int hashCode(){
-    return value.hashCode();
-  }
-}
diff --git a/developer/javac/LabelList.java b/developer/javac/LabelList.java
deleted file mode 100644 (file)
index 85acde8..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// LabelList.java
-package com.ReasoningTechnology.Ariadne;
-import java.util.List; 
-import java.util.ArrayList;
-
-public class LabelList extends ArrayList<Label> {
-  // Constructor
-  public LabelList(){
-    super();
-  }
-  public LabelList(List<Label> labels){
-    super();  // Initialize the parent class
-    if (labels != null) {
-      this.addAll(labels);  // Copy all elements from the provided list
-    }
-  }
-
-}
diff --git a/developer/javac/Node.java b/developer/javac/Node.java
deleted file mode 100644 (file)
index db0aa8d..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.ReasoningTechnology.Ariadne;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.util.List;
-
-public class Node extends HashMap<String, Object>{
-
-  private static String mark_property_name = "mark";
-  private static String neighbor_property_name = "neighbor";
-
-  public Node(){
-    super();
-    // Initialize the neighbor list in the constructor
-    this.put(neighbor_property_name, new LabelList());
-  }
-
-  public void mark(Token token){
-    if( this.get(mark_property_name) == null ){
-      this.put(mark_property_name, new TokenSet());
-    }
-    ((TokenSet)this.get(mark_property_name)).add(token);
-  }
-
-  public boolean has_mark(Token token){
-    TokenSet mark = (TokenSet)this.get(mark_property_name);
-    return mark != null && mark.contains(token);
-  }
-
-  // Return the neighbor list (always exists after initialization)
-  public LabelList neighbor_LabelList(){
-    return (LabelList)this.get(neighbor_property_name);
-  }
-
-}
diff --git a/developer/javac/NodeList.java b/developer/javac/NodeList.java
deleted file mode 100644 (file)
index 189cf83..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// NodeList.java
-package com.ReasoningTechnology.Ariadne;
-import java.util.ArrayList;
-
-public class NodeList extends ArrayList<Node> {
-  // Constructor
-  public NodeList(){
-    super();
-  }
-}
diff --git a/developer/javac/Production.java b/developer/javac/Production.java
deleted file mode 100644 (file)
index 1639c56..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-// Production.java
-package com.ReasoningTechnology.Ariadne;
-import java.util.function.Function;
-
-public interface Production extends Function<Label, Node> {}
diff --git a/developer/javac/ProductionList.java b/developer/javac/ProductionList.java
deleted file mode 100644 (file)
index 7973193..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// ProductionList.java
-package com.ReasoningTechnology.Ariadne;
-import java.util.ArrayList;
-
-public class ProductionList extends ArrayList<Production> {
-  // Constructor
-  public ProductionList(){
-    super();
-  }
-}
diff --git a/developer/javac/Token.java b/developer/javac/Token.java
deleted file mode 100644 (file)
index 37d7c2b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.ReasoningTechnology.Ariadne;
-
-/*
-An error token.
-
-*/
-public class Token {
-  private final String value;
-
-  public Token(String value){
-    this.value = value;
-  }
-
-  public String get(){
-    return value;
-  }
-
-  @Override
-  public String toString(){
-    return value;
-  }
-
-  @Override
-  public boolean equals(Object o){
-    if(this == o) return true;  // No padding, not nested
-    if( o == null || getClass() != o.getClass() ) return false;  // Padded, because it's nested
-    Token token = (Token)o;
-    return value.equals( token.value );
-  }
-
-  @Override
-  public int hashCode(){
-    return value.hashCode();
-  }
-}
diff --git a/developer/javac/TokenSet.java b/developer/javac/TokenSet.java
deleted file mode 100644 (file)
index a05443f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// TokenSet.java
-package com.ReasoningTechnology.Ariadne;
-import java.util.HashSet;
-
-public class TokenSet extends HashSet<Token> {
-  // Constructor
-  public TokenSet(){
-    super();
-  }
-}
diff --git a/developer/javac/Util.java b/developer/javac/Util.java
deleted file mode 100644 (file)
index 571e7e3..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.ReasoningTechnology.Ariadne;
-import java.util.List; 
-
-public class Util{
-  static boolean debug = false;
-
-  public static void print_list(String prefix ,List<?> item_list){
-    if( item_list == null || item_list.isEmpty() ){
-      return;
-    }
-    if( prefix != null && !prefix.isEmpty() ){
-      System.out.print(prefix);
-    }
-    int i = 0;
-    int n = item_list.size() - 1;
-    System.out.print( " '" + item_list.get(i) + "'" );
-    do{
-      i++;
-      if( i > n ) break;
-      System.out.print(", " +  "'" + item_list.get(i) + "'");
-    }while( true );
-    System.out.println(".");
-  }
-
-}
diff --git a/developer/scratch_pad/.gitignore b/developer/scratch_pad/.gitignore
deleted file mode 100644 (file)
index 120f485..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!/.gitignore
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_File.class b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_File.class
new file mode 100644 (file)
index 0000000..4b98d49
Binary files /dev/null and b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_File.class differ
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Graph.class b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Graph.class
new file mode 100644 (file)
index 0000000..62d3324
Binary files /dev/null and b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Graph.class differ
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_GraphDirectedAcyclic$1.class b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_GraphDirectedAcyclic$1.class
new file mode 100644 (file)
index 0000000..93f660e
Binary files /dev/null and b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_GraphDirectedAcyclic$1.class differ
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_GraphDirectedAcyclic$2.class b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_GraphDirectedAcyclic$2.class
new file mode 100644 (file)
index 0000000..44ebef8
Binary files /dev/null and b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_GraphDirectedAcyclic$2.class differ
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_GraphDirectedAcyclic.class b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_GraphDirectedAcyclic.class
new file mode 100644 (file)
index 0000000..ea91787
Binary files /dev/null and b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_GraphDirectedAcyclic.class differ
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Label.class b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Label.class
new file mode 100644 (file)
index 0000000..21983fd
Binary files /dev/null and b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Label.class differ
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_LabelList.class b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_LabelList.class
new file mode 100644 (file)
index 0000000..079acaf
Binary files /dev/null and b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_LabelList.class differ
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Node.class b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Node.class
new file mode 100644 (file)
index 0000000..e03285e
Binary files /dev/null and b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Node.class differ
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_NodeList.class b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_NodeList.class
new file mode 100644 (file)
index 0000000..f7d264b
Binary files /dev/null and b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_NodeList.class differ
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Production.class b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Production.class
new file mode 100644 (file)
index 0000000..776a9af
Binary files /dev/null and b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Production.class differ
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_ProductionList.class b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_ProductionList.class
new file mode 100644 (file)
index 0000000..c02c0d1
Binary files /dev/null and b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_ProductionList.class differ
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Token.class b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Token.class
new file mode 100644 (file)
index 0000000..7924271
Binary files /dev/null and b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Token.class differ
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_TokenSet.class b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_TokenSet.class
new file mode 100644 (file)
index 0000000..c623bdc
Binary files /dev/null and b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_TokenSet.class differ
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Util.class b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Util.class
new file mode 100644 (file)
index 0000000..cd8d2d7
Binary files /dev/null and b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Ariadne_Util.class differ
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/File.java b/developer/scratchpad/com/ReasoningTechnology/Ariadne/File.java
new file mode 100644 (file)
index 0000000..825b499
--- /dev/null
@@ -0,0 +1,76 @@
+package com.ReasoningTechnology.Ariadne;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Ariadne_File {
+  static boolean debug = false;
+
+  public static Map<String, String> unpack_file_path(String file_fp) {
+    if (debug) System.out.println("unpack_file_path::file_fp: " + file_fp);
+
+    // Use java.io.File explicitly to avoid conflict with the custom Ariadne_File class
+    java.io.File file = new java.io.File(file_fp);
+    String parent_dp = (file.getParent() != null) ? file.getParent() : "";
+
+    if (!parent_dp.isEmpty() && !parent_dp.endsWith(java.io.File.separator)) {
+      parent_dp += java.io.File.separator;
+    }
+
+    String file_fn = file.getName();
+    String file_fn_base = file_fn;
+    String file_fn_ext = "";
+
+    int last_index = file_fn.lastIndexOf('.');
+    if (last_index > 0) {
+      file_fn_base = file_fn.substring(0, last_index);
+      if (last_index + 1 < file_fn.length()) {
+        file_fn_ext = file_fn.substring(last_index + 1);
+      }
+    }
+
+    Map<String, String> ret_val = new HashMap<>();
+    ret_val.put("dp", parent_dp);
+    ret_val.put("fn", file_fn);
+    ret_val.put("fn_base", file_fn_base);
+    ret_val.put("fn_ext", file_fn_ext);
+
+    if (debug) System.out.println("unpack_file_path::ret_val: " + ret_val);
+
+    return ret_val;
+  }
+
+  public static boolean file_exists_q(String fp_string) {
+    Path fp_object = Paths.get(fp_string);
+    return Files.exists(fp_object);
+  }
+
+  /*
+    Given a target_fp and a list of dependency_fp.
+
+    Returns false if the target is newer than all dependencies or if a file is missing;
+    otherwise, returns true.
+  */
+  public static boolean newer_than_all(String target_fp_string, List<String> dependency_fp_list) throws IOException {
+    Path target_fp_object = Paths.get(target_fp_string);
+    if (!Files.exists(target_fp_object)) return false;
+
+    long target_last_modified_time = Files.getLastModifiedTime(target_fp_object).toMillis();
+
+    return dependency_fp_list.stream().allMatch(dependency_fp -> {
+      try {
+        Path dependency_fp_object = Paths.get(dependency_fp);
+        if (!Files.exists(dependency_fp_object)) return false;
+        long dependency_last_modified_time = Files.getLastModifiedTime(dependency_fp_object).toMillis();
+        return target_last_modified_time > dependency_last_modified_time;
+      } catch (IOException e) {
+        return false;
+      }
+    });
+  }
+}
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Graph.java b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Graph.java
new file mode 100644 (file)
index 0000000..d50c429
--- /dev/null
@@ -0,0 +1,63 @@
+package com.ReasoningTechnology.Ariadne;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Graph{
+
+  /*--------------------------------------------------------------------------------
+    constructors
+  */
+
+  public Graph(Map<Label ,Node> node_map ,ProductionList recognizer_f_list){
+    if(node_map == null && recognizer_f_list == null){
+      System.err.println("AriadneGraph: At least one of 'node_map' (Map) or 'recognizer_f_list' (List) must be provided.");
+      System.exit(1);
+    }
+
+    // Initialize each of node_map and recognizer_f_list to empty collections if null
+    this.node_map = (node_map != null) ? node_map : new HashMap<Label ,Node>();
+    this.recognizer_f_list = (recognizer_f_list != null) ? recognizer_f_list : new ProductionList();
+  }
+
+  /*--------------------------------------------------------------------------------
+   instance data 
+  */
+
+  private static boolean debug = true;
+  private Map<Label ,Node> node_map;
+  private ProductionList recognizer_f_list;
+
+  /*--------------------------------------------------------------------------------
+   interface
+  */
+
+  // Lookup method to find a node by its label
+  public Node lookup(Label node_label ,boolean verbose){
+    if( node_label == null || node_label.isEmpty() ){
+      if(verbose){
+        System.out.println("lookup:: given node_label is null or empty.");
+      }
+      return null;
+    }
+
+    // Try to retrieve the node from the map
+    Node node = this.node_map.get(node_label);
+
+    if(verbose){
+      if(node != null){
+        System.out.println("lookup:: found node: " + node);
+      } else {
+        System.out.println("lookup:: node not found for label: " + node_label);
+      }
+    }
+
+    return node;
+  }
+
+  // Overloaded lookup method with default verbosity (true)
+  public Node lookup(Label node_label){
+    return lookup(node_label ,true);
+  }
+
+}
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/GraphDirectedAcyclic.java b/developer/scratchpad/com/ReasoningTechnology/Ariadne/GraphDirectedAcyclic.java
new file mode 100644 (file)
index 0000000..f01e8de
--- /dev/null
@@ -0,0 +1,282 @@
+package com.ReasoningTechnology.Ariadne;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+
+public class GraphDirectedAcyclic extends Graph{
+
+  /*--------------------------------------------------------------------------------
+    constructors
+  */
+
+  public GraphDirectedAcyclic(Map<Label ,Node> node_map ,ProductionList recognizer_f_list ,LabelList root_node_list ,int max_depth ,boolean verbose){
+    super( node_map ,recognizer_f_list );
+    TokenSet cycle_detection_result = graph_mark_cycles(root_node_list ,max_depth ,verbose);
+  }
+
+  public GraphDirectedAcyclic(Map<Label ,Node> node_map ,ProductionList recognizer_f_list ,LabelList root_node_list){
+    super( node_map ,recognizer_f_list );
+    TokenSet cycle_detection_result = graph_mark_cycles(root_node_list);
+  }
+
+
+  /*--------------------------------------------------------------------------------
+   instance data extension
+  */
+
+  private static boolean debug = true;
+
+
+  /*--------------------------------------------------------------------------------
+    Interface
+  */
+
+  /*
+    Given a path to a node in the graph, `left_path`.
+
+    Checks if the rightmost node (referenced by label) recurs earlier in the path.
+    Presumably the rightmost node has been recently appended to the path.
+
+    If there is no cycle, returns null, otherwise returns the interval [i ,n],
+    of indexes into the path where the cycle is found. `n` will always be
+    the index of the rightmost node in the path list.
+  */
+  private List<Integer>  path_find_cycle(LabelList path ){
+    if( path.size() <= 1 ) return null; 
+
+    int rightmost_index = path.size() - 1;
+    Label rightmost_node_label = path.get( rightmost_index );
+
+    // if there is no cycle, searching for rightmost_node_label will find itself:
+    int cycle_leftmost_index = path.indexOf(rightmost_node_label);
+    Boolean has_cycle = cycle_leftmost_index < rightmost_index;
+    if( ! has_cycle ) return null;
+
+    List<Integer> result = new ArrayList<>();
+    result.add(cycle_leftmost_index);
+    result.add(rightmost_index);
+    return result;
+  }
+
+  /*
+    Given a path_stack, which is our graph iterator.  Also given `left_path`
+    which is derived from path_stack, and represents the left most neighbor
+    of each of the neighbor lists in the path_stack.
+
+    Calls `path_find_cycle` to see if the most recently added to the path node,
+    i.e. the rightmost node, forms a cycle with other node(s) in the path.  Upon
+    finding a cycle, unwinds the path_stack (decrements the iterator), to the top
+    of the cycle.
+
+    If a cycle is found, returns false, otherwise returns true.
+  */
+  private boolean graph_descend_cycle_case( LabelList left_path ,List<LabelList> path_stack ,boolean verbose ){
+
+    List<Integer> cycle_index_interval = path_find_cycle(left_path);
+    if( cycle_index_interval == null ){
+      return false; // No cycle found
+    }
+
+    int cycle_i0 = cycle_index_interval.get(0); // Cycle leftmost, inclusive
+    int cycle_n = cycle_index_interval.get(1);  // Cycle rightmost, inclusive
+
+    if(verbose) Util.print_list(
+      "Found cycle:" 
+      ,left_path.subList( cycle_i0 ,cycle_n + 1)
+    );
+
+    // Mark cycle members
+    LabelList undefined_node_list = new LabelList();
+    for( int i = cycle_i0; i <= cycle_n; i++ ){
+      Label node_label = left_path.get(i);
+      Node node = super.lookup( node_label );
+      if (node != null){
+        node.mark(new Token("cycle_member"));
+      }else{
+        undefined_node_list.add( node_label );
+      }
+    }
+
+    if(verbose) Util.print_list(
+      "Each undefined node could not be marked as a cycle member:" 
+      ,undefined_node_list
+    );
+
+    // Reset the graph iterator to the top of the cycle
+    path_stack.subList( cycle_i0 + 1 ,cycle_n + 1 ).clear();
+
+    return true; // cycle found
+  }
+  
+  /*
+    Given a path_stack initialized to the root nodes for the graph traversal.
+
+    Perform depth first descent from each node in succession while searching for
+    cycles by calling graph_descent_cycle_case. Algorithm follows the leftmost
+    nodes in the path_stack list of child lists.
+
+    Returns the descent termination condition.
+  */
+  private static TokenSet graph_descend_set = new TokenSet() {{
+    add(new Token("empty_path_stack"));
+    add(new Token("cycle_found"));
+    add(new Token("undefined_node"));
+    add(new Token("leaf"));
+    add(new Token("max_depth_reached"));
+  }};
+  private TokenSet graph_descend( List<LabelList> path_stack ,int max_depth ,boolean verbose ){
+    TokenSet ret_value = new TokenSet();
+
+    if( path_stack.isEmpty() ){
+      ret_value.add( new Token("empty_path_stack") );
+      return ret_value;
+    }
+
+    // a leftmost path through the neighbor lists of the leftmost nodes
+    LabelList left_path = new LabelList();
+    for( LabelList neighbor_list : path_stack ){
+      left_path.add( neighbor_list.get(0) );
+    }
+
+    // do descend
+    do{
+
+      // cycle case
+      if( graph_descend_cycle_case( left_path ,path_stack ,verbose ) ){
+        ret_value.add( new Token("cycle_found") );
+        return ret_value;
+      }
+
+      // Non-cycle case, descend further into the tree.
+      // Increment the graph iterator (path_stack) to go down a level.
+      Label it_node_label = path_stack.get( path_stack.size() - 1 ).get(0);
+      Node it_node = super.lookup( it_node_label );
+      if( it_node == null ){
+        ret_value.add( new Token("undefined_node") );
+        return ret_value;
+      }
+        
+      LabelList neighbor_list = it_node.neighbor_LabelList();
+      if( neighbor_list.isEmpty() ){
+        ret_value.add( new Token("leaf") );
+        return ret_value;
+      }
+
+      // The iterator will destroy the neighbor_list as we traverse the graph,
+      // so we give it a copy.
+      path_stack.add( new LabelList(neighbor_list) );
+      Label it_next_label = neighbor_list.get(0);
+      left_path.add( it_next_label ); // also extend the left_path
+
+      // bound the size of problem we are willing to work on
+      // set max_depth <= 0 to have this test ignored
+      if( max_depth > 0 ){
+        max_depth--;  // Typo fixed
+        if( max_depth == 0 ){
+          if(verbose){
+            Util.print_list("GraphDirectedAcyclic.GraphDescend:: max_depth reached, preternaturally ending the descent:" ,path_stack);
+          }
+          ret_value.add( new Token("max_depth_reached") );
+          return ret_value;
+        }
+      }
+
+    }while(true); // while descend
+  }
+
+   
+  /*
+    Given root_node_label_list and a maximum depth for traversal.
+
+    Cycles are handled gracefully, rather the constraint `max_depth` is present
+    because the user is allowed to provide production *functions* for generating
+    nodes. Who knows what crazy graphs a user could come up with, see the
+    document on the algorithm for more info.
+  
+    Does a left first depth first traversal of the graph while marking
+    cycles. This routine pushes the graph traversal iterator to the right one
+    node after a left descent traversal, then it calls `graph_descend` descend
+    from said node.
+
+    Returns one or more symbols that characterize the termination condition.
+  */
+
+  public static TokenSet graph_mark_cycles_set = new TokenSet() {{
+    add(new Token("empty_root_label_list"));
+    add(new Token("cycle_exists"));
+    add(new Token("undefined_node_exists"));
+    add(new Token("bad_descent_termination"));
+    add(new Token("max_depth_reached"));
+  }};
+  public TokenSet graph_mark_cycles( LabelList root_node_LabelList ,int max_depth ,boolean verbose ){
+    TokenSet ret_value = new TokenSet();
+    boolean exists_malformed = false;
+    TokenSet result; // used variously
+
+    if( root_node_LabelList.isEmpty() ){
+      ret_value.add(new Token("empty_root_label_list"));
+      return ret_value;
+    }
+
+    // `path_stack` is our graph iterator. It is initialized with the
+    // `root_node_LabelList`.
+    List<LabelList> path_stack = new ArrayList<>();
+    path_stack.add( new LabelList(root_node_LabelList) );
+
+    // each call to graph_descend does a leftmost descent to a leaf
+    do{
+      result = graph_descend( path_stack ,max_depth ,verbose );
+      if( result.contains(new Token("cycle_found")) ) ret_value.add(new Token("cycle_exists"));
+      if( result.contains(new Token("undefined_node")) ) ret_value.add(new Token("undefined_node_exists"));
+      if( result.contains(new Token("max_depth_reached")) ) ret_value.add(new Token("max_depth_reached"));
+      if( !result.contains(new Token("leaf")) && !result.contains(new Token("cycle_found")) ) ret_value.add(new Token("bad_descent_termination"));
+
+      // Push the iterator to the right by one node
+      LabelList top_list = path_stack.get( path_stack.size() - 1 );
+      top_list.remove(0);
+      if( top_list.isEmpty() ) path_stack.remove( path_stack.size() - 1 );
+
+    }while( !path_stack.isEmpty() );
+
+    if(verbose){
+      if( ret_value.contains("bad_descent_termination") ){
+        System.out.println("GraphDirectedAcyclic.graph_mark_cycles:: graph_descend terminated with other than leaf or cycle found condition.");
+      }
+      if( ret_value.contains("cycle_exists") ){
+        System.out.println("GraphDirectedAcyclic.graph_mark_cycles:: There are one or more cycles in the graph.");
+      }
+      if( ret_value.contains("undefined_node_exists") ){
+        System.out.println("GraphDirectedAcyclic.graph_mark_cycles:: There are one or more node label references that do not correspond to a defined node in this graph.");
+      }
+    }
+
+    return ret_value;
+  }
+   public TokenSet graph_mark_cycles(LabelList root_node_LabelList){
+    return graph_mark_cycles(root_node_LabelList ,this.debug?40:-1 ,this.debug);
+  }
+  
+
+  /*--------------------------------------------------------------------------------
+    Graph traversal
+  */
+
+  @Override
+  public Node lookup(Label node_label, boolean verbose){
+    Node node = super.lookup(node_label, verbose);
+    if(node != null && node.has_mark(new Token("cycle_member"))){
+      if(verbose){
+        System.out.println("GraphDirectedAcyclic.lookup:: Node is part of a cycle so it will not be returned: " + node_label);
+      }
+      return null;  // Exclude nodes in cycles
+    }
+    return node;
+  }
+
+  public Node lookup(Label node_label){
+    return lookup(node_label ,this.debug);
+  }
+
+}
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Label.java b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Label.java
new file mode 100644 (file)
index 0000000..3d13f45
--- /dev/null
@@ -0,0 +1,42 @@
+package com.ReasoningTechnology.Ariadne;
+
+/*
+  A value for the node.label property.
+
+  This is a wrapper for a String. We can't instead use an alias by extending
+  String, because String is a JavaScript 'final' type.
+
+*/
+public class Label {
+  private final String value;
+
+  public Label(String value){
+    this.value = value;
+  }
+
+  public boolean isEmpty() {
+    return value.isEmpty();
+  }
+
+  public String get(){
+    return value;
+  }
+
+  @Override
+  public String toString(){
+    return value;
+  }
+
+  @Override
+  public boolean equals(Object o){
+    if(this == o) return true;
+    if( o == null || getClass() != o.getClass() ) return false;
+    Label label = (Label)o;
+    return value.equals( label.value );
+  }
+
+  @Override
+  public int hashCode(){
+    return value.hashCode();
+  }
+}
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/LabelList.java b/developer/scratchpad/com/ReasoningTechnology/Ariadne/LabelList.java
new file mode 100644 (file)
index 0000000..85acde8
--- /dev/null
@@ -0,0 +1,18 @@
+// LabelList.java
+package com.ReasoningTechnology.Ariadne;
+import java.util.List; 
+import java.util.ArrayList;
+
+public class LabelList extends ArrayList<Label> {
+  // Constructor
+  public LabelList(){
+    super();
+  }
+  public LabelList(List<Label> labels){
+    super();  // Initialize the parent class
+    if (labels != null) {
+      this.addAll(labels);  // Copy all elements from the provided list
+    }
+  }
+
+}
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Node.java b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Node.java
new file mode 100644 (file)
index 0000000..db0aa8d
--- /dev/null
@@ -0,0 +1,34 @@
+package com.ReasoningTechnology.Ariadne;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Node extends HashMap<String, Object>{
+
+  private static String mark_property_name = "mark";
+  private static String neighbor_property_name = "neighbor";
+
+  public Node(){
+    super();
+    // Initialize the neighbor list in the constructor
+    this.put(neighbor_property_name, new LabelList());
+  }
+
+  public void mark(Token token){
+    if( this.get(mark_property_name) == null ){
+      this.put(mark_property_name, new TokenSet());
+    }
+    ((TokenSet)this.get(mark_property_name)).add(token);
+  }
+
+  public boolean has_mark(Token token){
+    TokenSet mark = (TokenSet)this.get(mark_property_name);
+    return mark != null && mark.contains(token);
+  }
+
+  // Return the neighbor list (always exists after initialization)
+  public LabelList neighbor_LabelList(){
+    return (LabelList)this.get(neighbor_property_name);
+  }
+
+}
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/NodeList.java b/developer/scratchpad/com/ReasoningTechnology/Ariadne/NodeList.java
new file mode 100644 (file)
index 0000000..189cf83
--- /dev/null
@@ -0,0 +1,10 @@
+// NodeList.java
+package com.ReasoningTechnology.Ariadne;
+import java.util.ArrayList;
+
+public class NodeList extends ArrayList<Node> {
+  // Constructor
+  public NodeList(){
+    super();
+  }
+}
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Production.java b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Production.java
new file mode 100644 (file)
index 0000000..1639c56
--- /dev/null
@@ -0,0 +1,5 @@
+// Production.java
+package com.ReasoningTechnology.Ariadne;
+import java.util.function.Function;
+
+public interface Production extends Function<Label, Node> {}
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/ProductionList.java b/developer/scratchpad/com/ReasoningTechnology/Ariadne/ProductionList.java
new file mode 100644 (file)
index 0000000..7973193
--- /dev/null
@@ -0,0 +1,10 @@
+// ProductionList.java
+package com.ReasoningTechnology.Ariadne;
+import java.util.ArrayList;
+
+public class ProductionList extends ArrayList<Production> {
+  // Constructor
+  public ProductionList(){
+    super();
+  }
+}
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Token.java b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Token.java
new file mode 100644 (file)
index 0000000..37d7c2b
--- /dev/null
@@ -0,0 +1,35 @@
+package com.ReasoningTechnology.Ariadne;
+
+/*
+An error token.
+
+*/
+public class Token {
+  private final String value;
+
+  public Token(String value){
+    this.value = value;
+  }
+
+  public String get(){
+    return value;
+  }
+
+  @Override
+  public String toString(){
+    return value;
+  }
+
+  @Override
+  public boolean equals(Object o){
+    if(this == o) return true;  // No padding, not nested
+    if( o == null || getClass() != o.getClass() ) return false;  // Padded, because it's nested
+    Token token = (Token)o;
+    return value.equals( token.value );
+  }
+
+  @Override
+  public int hashCode(){
+    return value.hashCode();
+  }
+}
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/TokenSet.java b/developer/scratchpad/com/ReasoningTechnology/Ariadne/TokenSet.java
new file mode 100644 (file)
index 0000000..a05443f
--- /dev/null
@@ -0,0 +1,10 @@
+// TokenSet.java
+package com.ReasoningTechnology.Ariadne;
+import java.util.HashSet;
+
+public class TokenSet extends HashSet<Token> {
+  // Constructor
+  public TokenSet(){
+    super();
+  }
+}
diff --git a/developer/scratchpad/com/ReasoningTechnology/Ariadne/Util.java b/developer/scratchpad/com/ReasoningTechnology/Ariadne/Util.java
new file mode 100644 (file)
index 0000000..571e7e3
--- /dev/null
@@ -0,0 +1,25 @@
+package com.ReasoningTechnology.Ariadne;
+import java.util.List; 
+
+public class Util{
+  static boolean debug = false;
+
+  public static void print_list(String prefix ,List<?> item_list){
+    if( item_list == null || item_list.isEmpty() ){
+      return;
+    }
+    if( prefix != null && !prefix.isEmpty() ){
+      System.out.print(prefix);
+    }
+    int i = 0;
+    int n = item_list.size() - 1;
+    System.out.print( " '" + item_list.get(i) + "'" );
+    do{
+      i++;
+      if( i > n ) break;
+      System.out.print(", " +  "'" + item_list.get(i) + "'");
+    }while( true );
+    System.out.println(".");
+  }
+
+}
index faf844d..6629cdc 100755 (executable)
@@ -1,32 +1,53 @@
 #!/bin/env bash
 script_afp=$(realpath "${BASH_SOURCE[0]}")
 
-# This script links the sources into the directory tree in parallel to the package.
+# This script links the sources in javac into the directory tree that parallels
+# the package name in scratch_pad.  If the `-nolink` option is specified,
+# it makes a copy instead of a link.
 
 # Input guards
-
-  env_must_be="developer/tool/env"
-  if [ "$ENV" != "$env_must_be" ]; then
-    echo "$(script_fp):: error: must be run in the $env_must_be environment"
-    exit 1
-  fi
-
-  cd "$REPO_HOME"/developer
-
-# Link sources into the package tree
-
-  package_tree="scratchpad/com/ReasoningTechnology/$PROJECT"
-  mkdir -p "$package_tree"
-  echo "Package: $package_tree"
-
-  echo -n "Linking:"
-  for source_file in javac/*.java; do
-    echo -n " $(basename "$source_file")"
-    link_target="$package_tree/$(basename "$source_file")"
+env_must_be="developer/tool/env"
+if [ "$ENV" != "$env_must_be" ]; then
+  echo "$script_afp:: error: must be run in the $env_must_be environment"
+  exit 1
+fi
+
+cd "$REPO_HOME"/developer || exit 1
+
+# Parse options
+nolink=false
+while [[ "$1" == -* ]]; do
+  case "$1" in
+    -nolink) nolink=true ;;
+    *) echo "$script_afp:: error: unknown option $1" && exit 1 ;;
+  esac
+  shift
+done
+
+# Set up package tree
+package_tree="scratchpad/com/ReasoningTechnology/$PROJECT"
+mkdir -p "$package_tree"
+echo "Package: $package_tree"
+
+# Process files
+echo -n "$([[ $nolink == true ]] && echo "Copying" || echo "Linking"):"
+for source_file in javac/*.java; do
+  echo -n " $(basename "$source_file")"
+  link_target="$package_tree/$(basename "$source_file")"
+  # Copy the file if -nolink option is provided, otherwise create a link
+  if [[ $nolink == true ]]; then
+   # Remove link if present, otherwise copy will try to overwrite the link target (and fail).
+    rm -f "$link_target"
+    cp "$source_file" "$link_target"
+  else
+    # Create a symbolic link if -nolink is not provided
     if [ ! -L "$link_target" ]; then
       ln -s "$(realpath --relative-to="$package_tree" "$source_file")" "$link_target"
     fi
-  done
-  echo "."
+  fi
+done
+echo "."
+
+echo "$script_afp done."
+
 
-echo "$(script_fp) done."
index af08da9..968598e 100644 (file)
Binary files a/release/Ariadne.jar and b/release/Ariadne.jar differ
diff --git a/tester/deprecated/Test_File_0.java b/tester/deprecated/Test_File_0.java
new file mode 100644 (file)
index 0000000..44342ba
--- /dev/null
@@ -0,0 +1,114 @@
+import java.lang.reflect.Method;
+
+public class Test_File_0 {
+
+    public class TestSuite {
+
+        public Boolean unpack_file_path_0(In.MIO io) {
+            Boolean[] conditions = new Boolean[5];
+            int i = 0;
+
+            String test_fp = "/home/user/test.txt";
+            String expected_dp = "/home/user/";
+            String expected_fn = "test.txt";
+            String expected_fn_base = "test";
+            String expected_fn_ext = "txt";
+
+            try {
+                // Use reflection to call In.File.unpack_file_path
+                Method unpackFilePath = In.File.getMethod("unpack_file_path", String.class);
+                java.util.Map<String, String> result = (java.util.Map<String, String>) unpackFilePath.invoke(null, test_fp);
+
+                conditions[i++] = result.get("dp").equals(expected_dp);
+                conditions[i++] = result.get("fn").equals(expected_fn);
+                conditions[i++] = result.get("fn_base").equals(expected_fn_base);
+                conditions[i++] = result.get("fn_ext").equals(expected_fn_ext);
+                conditions[i++] = result.size() == 4;
+
+                Method allMethod = In.MU.getMethod("all", Boolean[].class);
+                return (Boolean) allMethod.invoke(null, (Object) conditions);
+            } catch (Exception e) {
+                e.printStackTrace();
+                return false;
+            }
+        }
+
+        public Boolean file_exists_q_0(In.MIO io) {
+            Boolean[] conditions = new Boolean[2];
+            int i = 0;
+
+            String repoHome = System.getenv("REPO_HOME");
+            String existingFilePath = repoHome + "/tester/data_Test_File_0/I_exist";
+            String nonExistentFilePath = repoHome + "/tester/data_Test_File_0/I_do_not_exist";
+
+            try {
+                // Use reflection to call In.File.file_exists_q
+                Method fileExistsMethod = In.File.getMethod("file_exists_q", String.class);
+                conditions[i++] = (Boolean) fileExistsMethod.invoke(null, existingFilePath);
+                conditions[i++] = !(Boolean) fileExistsMethod.invoke(null, nonExistentFilePath);
+
+                Method allMethod = In.MU.getMethod("all", Boolean[].class);
+                return (Boolean) allMethod.invoke(null, (Object) conditions);
+            } catch (Exception e) {
+                e.printStackTrace();
+                return false;
+            }
+        }
+
+        public Boolean newer_than_all_0(In.MIO io) throws java.io.IOException {
+            Boolean[] conditions = new Boolean[5];
+            int i = 0;
+
+            String repoHome = System.getenv("REPO_HOME");
+            String file_0 = repoHome + "/tester/data_Test_File_0/file_0";
+            String file_1 = repoHome + "/tester/data_Test_File_0/file_1";
+            String file_2 = repoHome + "/tester/data_Test_File_0/file_2";
+            String file_3 = repoHome + "/tester/data_Test_File_0/file_3";
+            String missing_file_0 = repoHome + "/tester/data_Test_File_0/missing_file_0";
+
+            try {
+                Method setLastModifiedTime = In.Files.getMethod("setLastModifiedTime", java.nio.file.Path.class, java.nio.file.attribute.FileTime.class);
+                Method getPath = In.Paths.getMethod("get", String.class);
+                Method fromMillis = In.FileTime.getMethod("fromMillis", long.class);
+
+                // Setting modification times
+                setLastModifiedTime.invoke(null, getPath.invoke(null, file_3), fromMillis.invoke(null, System.currentTimeMillis() - 20000));
+                setLastModifiedTime.invoke(null, getPath.invoke(null, file_2), fromMillis.invoke(null, System.currentTimeMillis() - 15000));
+                setLastModifiedTime.invoke(null, getPath.invoke(null, file_1), fromMillis.invoke(null, System.currentTimeMillis() - 10000));
+                setLastModifiedTime.invoke(null, getPath.invoke(null, file_0), fromMillis.invoke(null, System.currentTimeMillis() - 5000));
+
+                Method newerThanAll = In.File.getMethod("newer_than_all", String.class, java.util.List.class);
+                conditions[i++] = (Boolean) newerThanAll.invoke(null, file_0, java.util.List.of(file_1, file_2, file_3));
+
+                // Updating times and repeating checks
+                setLastModifiedTime.invoke(null, getPath.invoke(null, file_2), fromMillis.invoke(null, System.currentTimeMillis() + 10000));
+                conditions[i++] = !(Boolean) newerThanAll.invoke(null, file_0, java.util.List.of(file_1, file_2, file_3));
+
+                setLastModifiedTime.invoke(null, getPath.invoke(null, file_1), fromMillis.invoke(null, System.currentTimeMillis() + 15000));
+                conditions[i++] = !(Boolean) newerThanAll.invoke(null, file_0, java.util.List.of(file_1, file_2, file_3));
+
+                conditions[i++] = !(Boolean) newerThanAll.invoke(null, missing_file_0, java.util.List.of(file_1, file_2, file_3));
+
+                conditions[i++] = !(Boolean) newerThanAll.invoke(null, file_0, java.util.List.of(file_1, missing_file_0));
+
+                Method allMethod = In.MU.getMethod("all", Boolean[].class);
+                return (Boolean) allMethod.invoke(null, (Object) conditions);
+            } catch (Exception e) {
+                e.printStackTrace();
+                return false;
+            }
+        }
+    }
+
+    public static void main(String[] args) {
+        try {
+            Method runMethod = In.TB.getMethod("run", Object.class);
+            TestSuite suite = new Test_File_0().new TestSuite();
+            int result = (int) runMethod.invoke(null, suite);
+            System.exit(result);
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+    }
+}
diff --git a/tester/deprecated/Test_Graph_0.java b/tester/deprecated/Test_Graph_0.java
new file mode 100644 (file)
index 0000000..4c8dc6a
--- /dev/null
@@ -0,0 +1,72 @@
+
+
+public class Test_Graph_0 {
+
+  public class TestSuite {
+
+    // Test constructor with null parameters (expecting error message)
+    public Boolean graph_constructor_null_params(IO io) {
+      Boolean[] conditions = new Boolean[1];
+      int i = 0;
+
+      // Attempt to initialize Graph with both parameters null
+      new Graph(null, null);
+
+      // Capture stderr to check for error message
+      String stderrContent = io.get_err_content();
+      conditions[i++] = stderrContent.contains("AriadneGraph: At least one of 'node_map' (Map) or 'recognizer_f_list' (List) must be provided.");
+      io.clear_buffers();  // Clear after validation
+      return MU.all(conditions);
+    }
+
+    // Test lookup with populated node_map
+    public Boolean graph_lookup_populated_map(IO io) {
+      Boolean[] conditions = new Boolean[2];
+      int i = 0;
+
+      // Setup node_map with labeled nodes
+      Map<Label, Node> nodeMap = new HashMap<>();
+      Label label1 = new Label("node1");
+      Label label2 = new Label("node2");
+      Node node1 = new Node();
+      Node node2 = new Node();
+      nodeMap.put(label1, node1);
+      nodeMap.put(label2, node2);
+
+      Graph graph = new Graph(nodeMap, new ProductionList());
+
+      // Test lookup for existing and non-existing labels
+      conditions[i++] = graph.lookup(label1, true) == node1;
+      conditions[i++] = graph.lookup(new Label("nonexistent"), true) == null;
+
+      io.clear_buffers(); // Clear after each case
+      return MU.all(conditions);
+    }
+
+    // Test lookup without verbosity
+    public Boolean graph_lookup_non_verbose(IO io) {
+      Boolean[] conditions = new Boolean[1];
+      int i = 0;
+
+      // Initialize node_map with one node
+      Map<Label, Node> nodeMap = new HashMap<>();
+      Label label = new Label("singleNode");
+      Node node = new Node();
+      nodeMap.put(label, node);
+
+      Graph graph = new Graph(nodeMap, new ProductionList());
+
+      // Perform lookup without verbosity
+      Node result = graph.lookup(label, false);
+      conditions[i++] = result == node;  // Expected to find node without verbose output
+
+      return MU.all(conditions);
+    }
+  }
+
+  public static void main(String[] args) {
+    TestSuite suite = new Test_Graph_0().new TestSuite();
+    int result = TestBench.run(suite); 
+    System.exit(result);
+  }
+}
diff --git a/tester/deprecated/scratch_pad/.gitignore b/tester/deprecated/scratch_pad/.gitignore
new file mode 100644 (file)
index 0000000..120f485
--- /dev/null
@@ -0,0 +1,2 @@
+*
+!/.gitignore
index c38d8d5..63b716a 100644 (file)
@@ -1,4 +1,4 @@
-package com.ReasoningTechnology.Ariadne.TestBench;
+package com.ReasoningTechnology.Ariadne.Testbench;
 
 /*
 Component smoke test. At least call each method of each class.
@@ -7,7 +7,7 @@ Component smoke test. At least call each method of each class.
 
 
 import  com.ReasoningTechnology.Ariadne.*;
-import  com.ReasoningTechnology.TestBench.*;
+import  com.ReasoningTechnology.Testbench.*;
 import java.util.List;
 import java.util.Map;
 import java.util.ArrayList;
@@ -16,7 +16,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 
 
-public class Test2 extends TestBench{
+public class Test2 extends Testbench{
 
   public static boolean test_Label_0(){
     boolean[] conditions = new boolean[2];
@@ -202,8 +202,8 @@ public class Test2 extends TestBench{
     test_map.put("test_Graph_0", test_Graph_0());
     test_map.put("test_Util_print_list_0", test_Util_print_list_0());
 
-    // Run the tests using TestBench
-    TestBench.run( test_map );
+    // Run the tests using Testbench
+    Testbench.run( test_map );
   }
 
   // Main function to provide a shell interface for running tests
diff --git a/tester/javac/#Test_Node_0.java# b/tester/javac/#Test_Node_0.java#
deleted file mode 100644 (file)
index 98cf614..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-
-public class Test_Node_0 {
-
-  public class TestSuite {
-
-    public Boolean node_creation_0(IO io) {
-      Boolean[] conditions = new Boolean[2];
-      int i = 0;
-
-      // Test that neighbor list is initialized
-      Node node = new Node();
-      conditions[i++] = node.neighbor_LabelList() != null && node.neighbor_LabelList().isEmpty(); // Expect true
-
-      // Test that the mark property is not initialized until used
-      conditions[i++] = node.get("mark") == null; // Expect true
-
-      // Return true if all conditions are met
-      return MU.all(conditions);
-    }
-
-    public Boolean node_marking_0(IO io) {
-      Boolean[] conditions = new Boolean[3];
-      int i = 0;
-
-      Node node = new Node();
-      Token token1 = new Token("token1");
-      Token token2 = new Token("token2");
-
-      // Test marking the node with token1
-      node.mark(token1);
-      conditions[i++] = node.has_mark(token1); // Expect true
-      conditions[i++] = !node.has_mark(token2); // Expect false for unmarked token
-
-      // Test that mark property is now initialized and contains token1
-      TokenSet markSet = (TokenSet) node.get("mark");
-      conditions[i++] = markSet != null && markSet.contains(token1); // Expect true
-
-      // Return true if all conditions are met
-      return MU.all(conditions);
-    }
-
-    public Boolean node_neighbor_0(IO io) {
-      Boolean[] conditions = new Boolean[1];
-      int i = 0;
-
-      // Test adding and retrieving neighbors
-      Node node = new Node();
-      LabelList neighbors = node.neighbor_LabelList();
-      neighbors.add(new Label("neighbor1"));
-      neighbors.add(new Label("neighbor2"));
-      conditions[i++] = neighbors.size() == 2 && neighbors.get(0).get().equals("neighbor1") && neighbors.get(1).get().equals("neighbor2"); // Expect true
-
-      // Return true if all conditions are met
-      return MU.all(conditions);
-    }
-  }
-
-  public static void main(String[] args) {
-    TestSuite suite = new Test_Node_0().new TestSuite();
-    int result = TestBench.run(suite); 
-    System.exit(result);
-  }
-}
diff --git a/tester/javac/In.java b/tester/javac/In.java
deleted file mode 100644 (file)
index 09d3af6..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-  Import to the package, rather than to individual files.
-*/
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.attribute.FileTime;
-import java.util.List;
-import java.util.Map;
-
-import com.ReasoningTechnology.Ariadne.File;
-import com.ReasoningTechnology.Ariadne.Util;
-import com.ReasoningTechnology.Mosaic.IO;
-import com.ReasoningTechnology.Mosaic.TestBench;
-
-
-public class In {
-    // Mosaic imports
-    public static final Class<com.ReasoningTechnology.Mosaic.IO> MIO = com.ReasoningTechnology.Mosaic.IO.class;
-    public static final Class<com.ReasoningTechnology.Mosaic.Util> MU = com.ReasoningTechnology.Mosaic.Util.class;
-    public static final Class<com.ReasoningTechnology.Mosaic.TestBench> TB = com.ReasoningTechnology.Mosaic.TestBench.class;
-
-    // Ariadne imports
-    public static final Class<com.ReasoningTechnology.Ariadne.File> File = com.ReasoningTechnology.Ariadne.File.class;
-    public static final Class<com.ReasoningTechnology.Ariadne.Util> AU = com.ReasoningTechnology.Ariadne.Util.class;
-    public static final Class<com.ReasoningTechnology.Ariadne.Graph> Graph = com.ReasoningTechnology.Ariadne.Graph.class;
-    public static final Class<com.ReasoningTechnology.Ariadne.Label> Label = com.ReasoningTechnology.Ariadne.Label.class;
-    public static final Class<com.ReasoningTechnology.Ariadne.LabelList> LabelList = com.ReasoningTechnology.Ariadne.LabelList.class;
-    public static final Class<com.ReasoningTechnology.Ariadne.Node> Node = com.ReasoningTechnology.Ariadne.Node.class;
-    public static final Class<com.ReasoningTechnology.Ariadne.NodeList> NodeList = com.ReasoningTechnology.Ariadne.NodeList.class;
-    public static final Class<com.ReasoningTechnology.Ariadne.ProductionList> ProductionList = com.ReasoningTechnology.Ariadne.ProductionList.class;
-    public static final Class<com.ReasoningTechnology.Ariadne.Token> Token = com.ReasoningTechnology.Ariadne.Token.class;
-    public static final Class<com.ReasoningTechnology.Ariadne.TokenSet> TokenSet = com.ReasoningTechnology.Ariadne.TokenSet.class;
-
-    // Java standard library imports
-    public static final Class<java.util.Arrays> Arrays = java.util.Arrays.class;
-    public static final Class<java.nio.file.Files> Files = java.nio.file.Files.class;
-    public static final Class<java.nio.file.Path> Path = java.nio.file.Path.class;
-    public static final Class<java.nio.file.Paths> Paths = java.nio.file.Paths.class;
-    public static final Class<java.nio.file.attribute.FileTime> FileTime = java.nio.file.attribute.FileTime.class;
-    public static final Class<java.util.HashMap> HashMap = java.util.HashMap.class;
-    public static final Class<java.util.List> List = java.util.List.class;
-    public static final Class<java.util.Map> Map = java.util.Map.class;
-}
-/*
-
-public class In {
-    // Class references for direct access to imported class definitions
-    public static final Class<?> MIO = com.ReasoningTechnology.Mosaic.IO.class;
-    public static final Class<?> MU = com.ReasoningTechnology.Mosaic.Util.class;
-    public static final Class<?> TestBench = com.ReasoningTechnology.Mosaic.TestBench.class;
-    
-    public static final Class<?> File = com.ReasoningTechnology.Ariadne.File.class;
-    public static final Class<?> Graph = com.ReasoningTechnology.Ariadne.Graph.class;
-    public static final Class<?> Label = com.ReasoningTechnology.Ariadne.Label.class;
-    public static final Class<?> LabelList = com.ReasoningTechnology.Ariadne.LabelList.class;
-    public static final Class<?> Node = com.ReasoningTechnology.Ariadne.Node.class;
-    public static final Class<?> NodeList = com.ReasoningTechnology.Ariadne.NodeList.class;
-    public static final Class<?> ProductionList = com.ReasoningTechnology.Ariadne.ProductionList.class;
-    public static final Class<?> Token = com.ReasoningTechnology.Ariadne.Token.class;
-    public static final Class<?> TokenSet = com.ReasoningTechnology.Ariadne.TokenSet.class;
-    public static final Class<?> AU = com.ReasoningTechnology.Ariadne.Util.class;
-
-    // For standard Java classes
-    public static final Class<?> Arrays = java.util.Arrays.class;
-    public static final Class<?> Files = java.nio.file.Files.class;
-    public static final Class<?> Path = java.nio.file.Path.class;
-    public static final Class<?> Paths = java.nio.file.Paths.class;
-    public static final Class<?> FileTime = java.nio.file.attribute.FileTime.class;
-    public static final Class<?> HashMap = java.util.HashMap.class;
-    public static final Class<?> List = java.util.List.class;
-    public static final Class<?> Map = java.util.Map.class;
-
-    // Optional: Utility methods to create instances or perform actions on these classes could be added here
-}
-*/
diff --git a/tester/javac/TestMosaicUtil.java b/tester/javac/TestMosaicUtil.java
deleted file mode 100644 (file)
index 17be83f..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-import com.ReasoningTechnology.Mosaic;  // Importing the entire Mosaic package
-
-public class TestMosaicUtil {
-
-    public static void main(String[] args) {
-        // Sample array of conditions to check with Util.all
-        Boolean[] conditions = {true, true, true};
-
-        // Using Mosaic.Util.all() to check if all conditions are true
-        boolean result = Mosaic.Util.all(conditions);
-
-        // Print the result
-        System.out.println("All conditions are true: " + result);
-    }
-}
index 44342ba..e3bb697 100644 (file)
@@ -1,10 +1,26 @@
+
+import java.io.IOException;
 import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.FileTime;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.ReasoningTechnology.Mosaic.Mosaic_IO;
+import com.ReasoningTechnology.Mosaic.Mosaic_Testbench;
+import com.ReasoningTechnology.Mosaic.Mosaic_Util;
+
+import com.ReasoningTechnology.Ariadne.Ariadne_File;
+
 
 public class Test_File_0 {
 
     public class TestSuite {
 
-        public Boolean unpack_file_path_0(In.MIO io) {
+        public Boolean unpack_file_path_0(Mosaic_IO io) {
             Boolean[] conditions = new Boolean[5];
             int i = 0;
 
@@ -15,9 +31,7 @@ public class Test_File_0 {
             String expected_fn_ext = "txt";
 
             try {
-                // Use reflection to call In.File.unpack_file_path
-                Method unpackFilePath = In.File.getMethod("unpack_file_path", String.class);
-                java.util.Map<String, String> result = (java.util.Map<String, String>) unpackFilePath.invoke(null, test_fp);
+                Map<String, String> result = Ariadne_File.unpack_file_path(test_fp);
 
                 conditions[i++] = result.get("dp").equals(expected_dp);
                 conditions[i++] = result.get("fn").equals(expected_fn);
@@ -25,15 +39,14 @@ public class Test_File_0 {
                 conditions[i++] = result.get("fn_ext").equals(expected_fn_ext);
                 conditions[i++] = result.size() == 4;
 
-                Method allMethod = In.MU.getMethod("all", Boolean[].class);
-                return (Boolean) allMethod.invoke(null, (Object) conditions);
+                return Mosaic_Util.all(conditions);
             } catch (Exception e) {
                 e.printStackTrace();
                 return false;
             }
         }
 
-        public Boolean file_exists_q_0(In.MIO io) {
+        public Boolean file_exists_q_0(Mosaic_IO io) {
             Boolean[] conditions = new Boolean[2];
             int i = 0;
 
@@ -41,21 +54,13 @@ public class Test_File_0 {
             String existingFilePath = repoHome + "/tester/data_Test_File_0/I_exist";
             String nonExistentFilePath = repoHome + "/tester/data_Test_File_0/I_do_not_exist";
 
-            try {
-                // Use reflection to call In.File.file_exists_q
-                Method fileExistsMethod = In.File.getMethod("file_exists_q", String.class);
-                conditions[i++] = (Boolean) fileExistsMethod.invoke(null, existingFilePath);
-                conditions[i++] = !(Boolean) fileExistsMethod.invoke(null, nonExistentFilePath);
+            conditions[i++] = Ariadne_File.file_exists_q(existingFilePath);
+            conditions[i++] = !Ariadne_File.file_exists_q(nonExistentFilePath);
 
-                Method allMethod = In.MU.getMethod("all", Boolean[].class);
-                return (Boolean) allMethod.invoke(null, (Object) conditions);
-            } catch (Exception e) {
-                e.printStackTrace();
-                return false;
-            }
+            return Mosaic_Util.all(conditions);
         }
 
-        public Boolean newer_than_all_0(In.MIO io) throws java.io.IOException {
+        public Boolean newer_than_all_0(Mosaic_IO io) throws IOException {
             Boolean[] conditions = new Boolean[5];
             int i = 0;
 
@@ -66,45 +71,33 @@ public class Test_File_0 {
             String file_3 = repoHome + "/tester/data_Test_File_0/file_3";
             String missing_file_0 = repoHome + "/tester/data_Test_File_0/missing_file_0";
 
-            try {
-                Method setLastModifiedTime = In.Files.getMethod("setLastModifiedTime", java.nio.file.Path.class, java.nio.file.attribute.FileTime.class);
-                Method getPath = In.Paths.getMethod("get", String.class);
-                Method fromMillis = In.FileTime.getMethod("fromMillis", long.class);
-
-                // Setting modification times
-                setLastModifiedTime.invoke(null, getPath.invoke(null, file_3), fromMillis.invoke(null, System.currentTimeMillis() - 20000));
-                setLastModifiedTime.invoke(null, getPath.invoke(null, file_2), fromMillis.invoke(null, System.currentTimeMillis() - 15000));
-                setLastModifiedTime.invoke(null, getPath.invoke(null, file_1), fromMillis.invoke(null, System.currentTimeMillis() - 10000));
-                setLastModifiedTime.invoke(null, getPath.invoke(null, file_0), fromMillis.invoke(null, System.currentTimeMillis() - 5000));
+            // Setting modification times
+            Files.setLastModifiedTime(Path.of(file_3), FileTime.fromMillis(System.currentTimeMillis() - 20000));
+            Files.setLastModifiedTime(Path.of(file_2), FileTime.fromMillis(System.currentTimeMillis() - 15000));
+            Files.setLastModifiedTime(Path.of(file_1), FileTime.fromMillis(System.currentTimeMillis() - 10000));
+            Files.setLastModifiedTime(Path.of(file_0), FileTime.fromMillis(System.currentTimeMillis() - 5000));
 
-                Method newerThanAll = In.File.getMethod("newer_than_all", String.class, java.util.List.class);
-                conditions[i++] = (Boolean) newerThanAll.invoke(null, file_0, java.util.List.of(file_1, file_2, file_3));
+            conditions[i++] = Ariadne_File.newer_than_all(file_0, List.of(file_1, file_2, file_3));
 
-                // Updating times and repeating checks
-                setLastModifiedTime.invoke(null, getPath.invoke(null, file_2), fromMillis.invoke(null, System.currentTimeMillis() + 10000));
-                conditions[i++] = !(Boolean) newerThanAll.invoke(null, file_0, java.util.List.of(file_1, file_2, file_3));
+            // Updating times and repeating checks
+            Files.setLastModifiedTime(Path.of(file_2), FileTime.fromMillis(System.currentTimeMillis() + 10000));
+            conditions[i++] = !Ariadne_File.newer_than_all(file_0, List.of(file_1, file_2, file_3));
 
-                setLastModifiedTime.invoke(null, getPath.invoke(null, file_1), fromMillis.invoke(null, System.currentTimeMillis() + 15000));
-                conditions[i++] = !(Boolean) newerThanAll.invoke(null, file_0, java.util.List.of(file_1, file_2, file_3));
+            Files.setLastModifiedTime(Path.of(file_1), FileTime.fromMillis(System.currentTimeMillis() + 15000));
+            conditions[i++] = !Ariadne_File.newer_than_all(file_0, List.of(file_1, file_2, file_3));
 
-                conditions[i++] = !(Boolean) newerThanAll.invoke(null, missing_file_0, java.util.List.of(file_1, file_2, file_3));
+            conditions[i++] = !Ariadne_File.newer_than_all(missing_file_0, List.of(file_1, file_2, file_3));
 
-                conditions[i++] = !(Boolean) newerThanAll.invoke(null, file_0, java.util.List.of(file_1, missing_file_0));
+            conditions[i++] = !Ariadne_File.newer_than_all(file_0, List.of(file_1, missing_file_0));
 
-                Method allMethod = In.MU.getMethod("all", Boolean[].class);
-                return (Boolean) allMethod.invoke(null, (Object) conditions);
-            } catch (Exception e) {
-                e.printStackTrace();
-                return false;
-            }
+            return Mosaic_Util.all(conditions);
         }
     }
 
     public static void main(String[] args) {
         try {
-            Method runMethod = In.TB.getMethod("run", Object.class);
             TestSuite suite = new Test_File_0().new TestSuite();
-            int result = (int) runMethod.invoke(null, suite);
+            int result = Mosaic_Testbench.run(suite);
             System.exit(result);
         } catch (Exception e) {
             e.printStackTrace();
index 4c8dc6a..fa85d74 100644 (file)
@@ -1,72 +1,82 @@
+import java.util.HashMap;
+import java.util.Map;
 
+import com.ReasoningTechnology.Mosaic.Mosaic_Util;
+import com.ReasoningTechnology.Mosaic.Mosaic_IO;
+import com.ReasoningTechnology.Mosaic.Mosaic_Testbench;
+
+import com.ReasoningTechnology.Ariadne.Ariadne_Graph;
+import com.ReasoningTechnology.Ariadne.Ariadne_Label;
+import com.ReasoningTechnology.Ariadne.Ariadne_Node;
+import com.ReasoningTechnology.Ariadne.Ariadne_ProductionList;
 
 public class Test_Graph_0 {
 
   public class TestSuite {
 
     // Test constructor with null parameters (expecting error message)
-    public Boolean graph_constructor_null_params(IO io) {
+    public Boolean graph_constructor_null_params(Mosaic_IO io) {
       Boolean[] conditions = new Boolean[1];
       int i = 0;
 
       // Attempt to initialize Graph with both parameters null
-      new Graph(null, null);
+      new Ariadne_Graph(null, null);
 
       // Capture stderr to check for error message
       String stderrContent = io.get_err_content();
       conditions[i++] = stderrContent.contains("AriadneGraph: At least one of 'node_map' (Map) or 'recognizer_f_list' (List) must be provided.");
       io.clear_buffers();  // Clear after validation
-      return MU.all(conditions);
+      return Mosaic_Util.all(conditions);
     }
 
     // Test lookup with populated node_map
-    public Boolean graph_lookup_populated_map(IO io) {
+    public Boolean graph_lookup_populated_map(Mosaic_IO io) {
       Boolean[] conditions = new Boolean[2];
       int i = 0;
 
       // Setup node_map with labeled nodes
-      Map<Label, Node> nodeMap = new HashMap<>();
-      Label label1 = new Label("node1");
-      Label label2 = new Label("node2");
-      Node node1 = new Node();
-      Node node2 = new Node();
+      Map<Ariadne_Label, Ariadne_Node> nodeMap = new HashMap<>();
+      Ariadne_Label label1 = new Ariadne_Label("node1");
+      Ariadne_Label label2 = new Ariadne_Label("node2");
+      Ariadne_Node node1 = new Ariadne_Node();
+      Ariadne_Node node2 = new Ariadne_Node();
       nodeMap.put(label1, node1);
       nodeMap.put(label2, node2);
 
-      Graph graph = new Graph(nodeMap, new ProductionList());
+      Ariadne_Graph graph = new Ariadne_Graph(nodeMap, new Ariadne_ProductionList());
 
       // Test lookup for existing and non-existing labels
       conditions[i++] = graph.lookup(label1, true) == node1;
-      conditions[i++] = graph.lookup(new Label("nonexistent"), true) == null;
+      conditions[i++] = graph.lookup(new Ariadne_Label("nonexistent"), true) == null;
 
       io.clear_buffers(); // Clear after each case
-      return MU.all(conditions);
+      return Mosaic_Util.all(conditions);
     }
 
     // Test lookup without verbosity
-    public Boolean graph_lookup_non_verbose(IO io) {
+    public Boolean graph_lookup_non_verbose(Mosaic_IO io) {
       Boolean[] conditions = new Boolean[1];
       int i = 0;
 
       // Initialize node_map with one node
-      Map<Label, Node> nodeMap = new HashMap<>();
-      Label label = new Label("singleNode");
-      Node node = new Node();
+      Map<Ariadne_Label, Ariadne_Node> nodeMap = new HashMap<>();
+      Ariadne_Label label = new Ariadne_Label("singleNode");
+      Ariadne_Node node = new Ariadne_Node();
       nodeMap.put(label, node);
 
-      Graph graph = new Graph(nodeMap, new ProductionList());
+      Ariadne_Graph graph = new Ariadne_Graph(nodeMap, new Ariadne_ProductionList());
 
       // Perform lookup without verbosity
-      Node result = graph.lookup(label, false);
+      Ariadne_Node result = graph.lookup(label, false);
       conditions[i++] = result == node;  // Expected to find node without verbose output
 
-      return MU.all(conditions);
+      return Mosaic_Util.all(conditions);
     }
   }
 
   public static void main(String[] args) {
     TestSuite suite = new Test_Graph_0().new TestSuite();
-    int result = TestBench.run(suite); 
+    int result = Mosaic_Testbench.run(suite); 
     System.exit(result);
   }
 }
index 3a6ea44..258362e 100644 (file)
@@ -1,31 +1,39 @@
+import java.util.Arrays;
+import java.util.List;
+
+import com.ReasoningTechnology.Mosaic.Mosaic_IO;
+import com.ReasoningTechnology.Mosaic.Mosaic_Util;
+import com.ReasoningTechnology.Mosaic.Mosaic_Testbench;
+
+import com.ReasoningTechnology.Ariadne.Ariadne_Label;
+import com.ReasoningTechnology.Ariadne.Ariadne_LabelList;
 
 public class Test_LabelList_0 {
 
   public class TestSuite {
 
-    public Boolean labelList_creation_0(IO io) {
+    public Boolean labelList_creation_0(Mosaic_IO io) {
       Boolean[] conditions = new Boolean[2];
       int i = 0;
 
       // Test the default constructor
-      LabelList emptyList = new LabelList();
+      Ariadne_LabelList emptyList = new Ariadne_LabelList();
       conditions[i++] = emptyList.isEmpty(); // Expect true for an empty list
 
       // Test the constructor with a list of labels
-      List<Label> labels = Arrays.asList(new Label("label1"), new Label("label2"));
-      LabelList labelList = new LabelList(labels);
+      List<Ariadne_Label> labels = Arrays.asList(new Ariadne_Label("label1"), new Ariadne_Label("label2"));
+      Ariadne_LabelList labelList = new Ariadne_LabelList(labels);
       conditions[i++] = labelList.size() == 2 && labelList.get(0).get().equals("label1") && labelList.get(1).get().equals("label2"); // Expect true for correct size and contents
 
       // Return true if all conditions are met
-      return MU.all(conditions);
+      return Mosaic_Util.all(conditions);
     }
 
   }
 
   public static void main(String[] args) {
     TestSuite suite = new Test_LabelList_0().new TestSuite();
-    int result = TestBench.run(suite); 
+    int result = Mosaic_Testbench.run(suite); 
     System.exit(result);
   }
-
 }
index 572e4fc..e304150 100644 (file)
@@ -1,16 +1,23 @@
 
+import com.ReasoningTechnology.Mosaic.Mosaic_IO;
+import com.ReasoningTechnology.Mosaic.Mosaic_Util;
+import com.ReasoningTechnology.Mosaic.Mosaic_Testbench;
+
+import com.ReasoningTechnology.Ariadne.Ariadne_Label;
+
+
 public class Test_Label_0 {
 
   public class TestSuite {
 
-    public Boolean label_creation_0(IO io) {
+    public Boolean label_creation_0(Mosaic_IO io) {
       Boolean[] conditions = new Boolean[4];
       int i = 0;
 
       // Test input
-      Label label1 = new Label("test");
-      Label label2 = new Label("");
-      Label label3 = new Label("test");
+      Ariadne_Label label1 = new Ariadne_Label("test");
+      Ariadne_Label label2 = new Ariadne_Label("");
+      Ariadne_Label label3 = new Ariadne_Label("test");
 
       // Check that the value is correctly set
       conditions[i++] = label1.get().equals("test"); // Expect true
@@ -19,14 +26,14 @@ public class Test_Label_0 {
       conditions[i++] = label1.hashCode() == label3.hashCode(); // Expect true, as hash should match for equal labels
 
       // Return true if all conditions are met
-      return MU.all(conditions);
+      return Mosaic_Util.all(conditions);
     }
 
   }
 
   public static void main(String[] args) {
     TestSuite suite = new Test_Label_0().new TestSuite();
-    int result = TestBench.run(suite); 
+    int result = Mosaic_Testbench.run(suite); 
     System.exit(result);
   }
 
index b220bc6..cb7f5a6 100644 (file)
@@ -1,31 +1,35 @@
+import com.ReasoningTechnology.Mosaic.Mosaic_IO;
+import com.ReasoningTechnology.Mosaic.Mosaic_Util;
+import com.ReasoningTechnology.Mosaic.Mosaic_Testbench;
 
+import com.ReasoningTechnology.Ariadne.Ariadne_Node;
+import com.ReasoningTechnology.Ariadne.Ariadne_NodeList;
 
 public class Test_NodeList_0 {
 
   public class TestSuite {
 
-    public Boolean nodeList_creation_0(IO io) {
+    public Boolean nodeList_creation_0(Mosaic_IO io) {
       Boolean[] conditions = new Boolean[2];
       int i = 0;
 
       // Test default constructor (expecting an empty NodeList)
-      NodeList nodeList = new NodeList();
+      Ariadne_NodeList nodeList = new Ariadne_NodeList();
       conditions[i++] = nodeList.isEmpty(); // Expect true for empty list
 
       // Add a node and verify presence
-      Node node = new Node();
+      Ariadne_Node node = new Ariadne_Node();
       nodeList.add(node);
       conditions[i++] = nodeList.size() == 1 && nodeList.contains(node); // Expect true for correct size and content
 
       // Return true if all conditions are met
-      return MU.all(conditions);
+      return Mosaic_Util.all(conditions);
     }
   }
 
   public static void main(String[] args) {
     TestSuite suite = new Test_NodeList_0().new TestSuite();
-    int result = TestBench.run(suite); 
+    int result = Mosaic_Testbench.run(suite); 
     System.exit(result);
   }
-
 }
index 3df3166..ae85d64 100644 (file)
@@ -1,36 +1,41 @@
-import com.ReasoningTechnology.Ariadne.Node;
-import com.ReasoningTechnology.Ariadne.Label;
-import com.ReasoningTechnology.Ariadne.LabelList;
-import com.ReasoningTechnology.Ariadne.Token;
-import com.ReasoningTechnology.Ariadne.TokenSet;
-import com.ReasoningTechnology.Mosaic.*;
+
+import com.ReasoningTechnology.Mosaic.Mosaic_IO;
+import com.ReasoningTechnology.Mosaic.Mosaic_Util;
+import com.ReasoningTechnology.Mosaic.Mosaic_Testbench;
+
+import com.ReasoningTechnology.Ariadne.Ariadne_Node;
+import com.ReasoningTechnology.Ariadne.Ariadne_Label;
+import com.ReasoningTechnology.Ariadne.Ariadne_LabelList;
+import com.ReasoningTechnology.Ariadne.Ariadne_Token;
+import com.ReasoningTechnology.Ariadne.Ariadne_TokenSet;
+
 
 public class Test_Node_0 {
 
   public class TestSuite {
 
-    public Boolean node_creation_0(IO io) {
+    public Boolean node_creation_0(Mosaic_IO io) {
       Boolean[] conditions = new Boolean[2];
       int i = 0;
 
       // Test that neighbor list is initialized
-      Node node = new Node();
+      Ariadne_Node node = new Ariadne_Node();
       conditions[i++] = node.neighbor_LabelList() != null && node.neighbor_LabelList().isEmpty(); // Expect true
 
       // Test that the mark property is not initialized until used
       conditions[i++] = node.get("mark") == null; // Expect true
 
       // Return true if all conditions are met
-      return MU.all(conditions);
+      return Mosaic_Util.all(conditions);
     }
 
-    public Boolean node_marking_0(IO io) {
+    public Boolean node_marking_0(Mosaic_IO io) {
       Boolean[] conditions = new Boolean[3];
       int i = 0;
 
-      Node node = new Node();
-      Token token1 = new Token("token1");
-      Token token2 = new Token("token2");
+      Ariadne_Node node = new Ariadne_Node();
+      Ariadne_Token token1 = new Ariadne_Token("token1");
+      Ariadne_Token token2 = new Ariadne_Token("token2");
 
       // Test marking the node with token1
       node.mark(token1);
@@ -38,32 +43,32 @@ public class Test_Node_0 {
       conditions[i++] = !node.has_mark(token2); // Expect false for unmarked token
 
       // Test that mark property is now initialized and contains token1
-      TokenSet markSet = (TokenSet) node.get("mark");
+      Ariadne_TokenSet markSet = (Ariadne_TokenSet) node.get("mark");
       conditions[i++] = markSet != null && markSet.contains(token1); // Expect true
 
       // Return true if all conditions are met
-      return MU.all(conditions);
+      return Mosaic_Util.all(conditions);
     }
 
-    public Boolean node_neighbor_0(IO io) {
+    public Boolean node_neighbor_0(Mosaic_IO io) {
       Boolean[] conditions = new Boolean[1];
       int i = 0;
 
       // Test adding and retrieving neighbors
-      Node node = new Node();
-      LabelList neighbors = node.neighbor_LabelList();
-      neighbors.add(new Label("neighbor1"));
-      neighbors.add(new Label("neighbor2"));
+      Ariadne_Node node = new Ariadne_Node();
+      Ariadne_LabelList neighbors = node.neighbor_LabelList();
+      neighbors.add(new Ariadne_Label("neighbor1"));
+      neighbors.add(new Ariadne_Label("neighbor2"));
       conditions[i++] = neighbors.size() == 2 && neighbors.get(0).get().equals("neighbor1") && neighbors.get(1).get().equals("neighbor2"); // Expect true
 
       // Return true if all conditions are met
-      return MU.all(conditions);
+      return Mosaic_Util.all(conditions);
     }
   }
 
   public static void main(String[] args) {
     TestSuite suite = new Test_Node_0().new TestSuite();
-    int result = TestBench.run(suite); 
+    int result = Mosaic_Testbench.run(suite); 
     System.exit(result);
   }
 }
index 624a1f5..53399e1 100644 (file)
@@ -1,32 +1,38 @@
+import com.ReasoningTechnology.Mosaic.Mosaic_IO;
+import com.ReasoningTechnology.Mosaic.Mosaic_Util;
+import com.ReasoningTechnology.Mosaic.Mosaic_Testbench;
+
+import com.ReasoningTechnology.Ariadne.Ariadne_Token;
+import com.ReasoningTechnology.Ariadne.Ariadne_TokenSet;
 
 public class Test_TokenSet_0 {
 
   public class TestSuite {
 
-    public Boolean tokenSet_creation_0(IO io) {
+    public Boolean tokenSet_creation_0(Mosaic_IO io) {
       Boolean[] conditions = new Boolean[2];
       int i = 0;
 
       // Test default constructor (expecting an empty TokenSet)
-      TokenSet tokenSet = new TokenSet();
+      Ariadne_TokenSet tokenSet = new Ariadne_TokenSet();
       conditions[i++] = tokenSet.isEmpty(); // Expect true for empty set
 
       // Add a token and verify presence
-      Token token = new Token("error");
+      Ariadne_Token token = new Ariadne_Token("error");
       tokenSet.add(token);
       conditions[i++] = tokenSet.size() == 1 && tokenSet.contains(token); // Expect true for correct size and content
 
       // Return true if all conditions are met
-      return MU.all(conditions);
+      return Mosaic_Util.all(conditions);
     }
 
-    public Boolean tokenSet_uniqueness_0(IO io) {
+    public Boolean tokenSet_uniqueness_0(Mosaic_IO io) {
       Boolean[] conditions = new Boolean[1];
       int i = 0;
 
-      TokenSet tokenSet = new TokenSet();
-      Token token1 = new Token("error");
-      Token token2 = new Token("error");
+      Ariadne_TokenSet tokenSet = new Ariadne_TokenSet();
+      Ariadne_Token token1 = new Ariadne_Token("error");
+      Ariadne_Token token2 = new Ariadne_Token("error");
 
       // Add two tokens with identical values and verify only one is stored
       tokenSet.add(token1);
@@ -34,14 +40,13 @@ public class Test_TokenSet_0 {
       conditions[i++] = tokenSet.size() == 1 && tokenSet.contains(token1) && tokenSet.contains(token2); // Expect true for single entry despite duplicate addition
 
       // Return true if all conditions are met
-      return MU.all(conditions);
+      return Mosaic_Util.all(conditions);
     }
   }
 
   public static void main(String[] args) {
     TestSuite suite = new Test_TokenSet_0().new TestSuite();
-    int result = TestBench.run(suite); 
+    int result = Mosaic_Testbench.run(suite); 
     System.exit(result);
   }
-
 }
index 715129c..2fe9c48 100644 (file)
@@ -1,16 +1,21 @@
+import com.ReasoningTechnology.Mosaic.Mosaic_IO;
+import com.ReasoningTechnology.Mosaic.Mosaic_Util;
+import com.ReasoningTechnology.Mosaic.Mosaic_Testbench;
+
+import com.ReasoningTechnology.Ariadne.Ariadne_Token;
 
 public class Test_Token_0 {
 
   public class TestSuite {
 
-    public Boolean token_creation_0(IO io) {
+    public Boolean token_creation_0(Mosaic_IO io) {
       Boolean[] conditions = new Boolean[4];
       int i = 0;
 
       // Test input
-      Token token1 = new Token("error");
-      Token token2 = new Token("warning");
-      Token token3 = new Token("error");
+      Ariadne_Token token1 = new Ariadne_Token("error");
+      Ariadne_Token token2 = new Ariadne_Token("warning");
+      Ariadne_Token token3 = new Ariadne_Token("error");
 
       // Check that the value is correctly set
       conditions[i++] = token1.get().equals("error"); // Expect true
@@ -19,28 +24,27 @@ public class Test_Token_0 {
       conditions[i++] = !token1.equals(token2); // Expect false, as values differ
 
       // Return true if all conditions are met
-      return MU.all(conditions);
+      return Mosaic_Util.all(conditions);
     }
 
-    public Boolean token_hashCode_0(IO io) {
+    public Boolean token_hashCode_0(Mosaic_IO io) {
       Boolean[] conditions = new Boolean[1];
       int i = 0;
 
-      Token token1 = new Token("error");
-      Token token2 = new Token("error");
+      Ariadne_Token token1 = new Ariadne_Token("error");
+      Ariadne_Token token2 = new Ariadne_Token("error");
 
       // Check that two identical tokens have the same hashCode
       conditions[i++] = token1.hashCode() == token2.hashCode(); // Expect true
 
       // Return true if all conditions are met
-      return MU.all(conditions);
+      return Mosaic_Util.all(conditions);
     }
   }
 
   public static void main(String[] args) {
     TestSuite suite = new Test_Token_0().new TestSuite();
-    int result = TestBench.run(suite); 
+    int result = Mosaic_Testbench.run(suite); 
     System.exit(result);
   }
-
 }
index 9f76216..15d9821 100644 (file)
@@ -1,15 +1,24 @@
+import com.ReasoningTechnology.Mosaic.Mosaic_IO;
+import com.ReasoningTechnology.Mosaic.Mosaic_Util;
+import com.ReasoningTechnology.Mosaic.Mosaic_Testbench;
+
+import com.ReasoningTechnology.Ariadne.Ariadne_Label;
+import com.ReasoningTechnology.Ariadne.Ariadne_Util;
+
+import java.util.List;
+import java.util.Arrays;
 
 public class Test_Util_0 {
 
   public class TestSuite {
 
-    public Boolean print_list_0(IO io) {
+    public Boolean print_list_0(Mosaic_IO io) {
       Boolean[] conditions = new Boolean[3];
       int i = 0;
 
       // Test with a non-empty list and a prefix
-      List<Label> itemList1 = Arrays.asList(new Label("first"), new Label("second"), new Label("third"));
-      Util.print_list("Items:", itemList1);
+      List<Ariadne_Label> itemList1 = Arrays.asList(new Ariadne_Label("first"), new Ariadne_Label("second"), new Ariadne_Label("third"));
+      Ariadne_Util.print_list("Items:", itemList1);
 
       // Capture and check stdout content
       String stdoutContent1 = io.get_out_content();
@@ -19,8 +28,8 @@ public class Test_Util_0 {
       io.clear_buffers();
 
       // Test with an empty list (no output expected)
-      List<Label> itemList2 = Arrays.asList();
-      Util.print_list("Empty:", itemList2);
+      List<Ariadne_Label> itemList2 = Arrays.asList();
+      Ariadne_Util.print_list("Empty:", itemList2);
       String stdoutContent2 = io.get_out_content();
       conditions[i++] = stdoutContent2.isEmpty(); // Expect no output for empty list
 
@@ -28,18 +37,18 @@ public class Test_Util_0 {
       io.clear_buffers();
 
       // Test with a null list (no output expected)
-      Util.print_list("Null:", null);
+      Ariadne_Util.print_list("Null:", null);
       String stdoutContent3 = io.get_out_content();
       conditions[i++] = stdoutContent3.isEmpty(); // Expect no output for null list
 
       // Return true if all conditions are met
-      return MU.all(conditions);
+      return Mosaic_Util.all(conditions);
     }
   }
 
   public static void main(String[] args) {
     TestSuite suite = new Test_Util_0().new TestSuite();
-    int result = TestBench.run(suite); 
+    int result = Mosaic_Testbench.run(suite); 
     System.exit(result);
   }
 
index 5febc4e..5029dc2 100644 (file)
Binary files a/tester/jvm/Test_Ariadne.jar and b/tester/jvm/Test_Ariadne.jar differ
diff --git a/tester/scratch_pad/.gitignore b/tester/scratch_pad/.gitignore
deleted file mode 100644 (file)
index 120f485..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!/.gitignore
diff --git a/tester/scratchpad/In$MIO.class b/tester/scratchpad/In$MIO.class
deleted file mode 100644 (file)
index 0e0675b..0000000
Binary files a/tester/scratchpad/In$MIO.class and /dev/null differ
diff --git a/tester/scratchpad/In$MU.class b/tester/scratchpad/In$MU.class
deleted file mode 100644 (file)
index b1c12c6..0000000
Binary files a/tester/scratchpad/In$MU.class and /dev/null differ
diff --git a/tester/scratchpad/In$TB.class b/tester/scratchpad/In$TB.class
deleted file mode 100644 (file)
index a29ca9b..0000000
Binary files a/tester/scratchpad/In$TB.class and /dev/null differ
diff --git a/tester/scratchpad/In$TestBench.class b/tester/scratchpad/In$TestBench.class
deleted file mode 100644 (file)
index a6d27ed..0000000
Binary files a/tester/scratchpad/In$TestBench.class and /dev/null differ
diff --git a/tester/scratchpad/In.class b/tester/scratchpad/In.class
deleted file mode 100644 (file)
index fab265e..0000000
Binary files a/tester/scratchpad/In.class and /dev/null differ
diff --git a/tester/scratchpad/MU.class b/tester/scratchpad/MU.class
deleted file mode 100644 (file)
index b2aeb68..0000000
Binary files a/tester/scratchpad/MU.class and /dev/null differ
index dc0ffab..c1af96b 100644 (file)
Binary files a/tester/scratchpad/Test_File_0$TestSuite.class and b/tester/scratchpad/Test_File_0$TestSuite.class differ
index dddf3c2..e11cee4 100644 (file)
Binary files a/tester/scratchpad/Test_File_0.class and b/tester/scratchpad/Test_File_0.class differ
index 04e4640..742b463 100644 (file)
Binary files a/tester/scratchpad/Test_Graph_0$TestSuite.class and b/tester/scratchpad/Test_Graph_0$TestSuite.class differ
index 25e5248..841c0d6 100644 (file)
Binary files a/tester/scratchpad/Test_Graph_0.class and b/tester/scratchpad/Test_Graph_0.class differ
index 750a839..0d7dacc 100644 (file)
Binary files a/tester/scratchpad/Test_LabelList_0$TestSuite.class and b/tester/scratchpad/Test_LabelList_0$TestSuite.class differ
index faec228..3ee484f 100644 (file)
Binary files a/tester/scratchpad/Test_LabelList_0.class and b/tester/scratchpad/Test_LabelList_0.class differ
index 743aac8..29c0468 100644 (file)
Binary files a/tester/scratchpad/Test_Label_0$TestSuite.class and b/tester/scratchpad/Test_Label_0$TestSuite.class differ
index f1c75e9..29e9e27 100644 (file)
Binary files a/tester/scratchpad/Test_Label_0.class and b/tester/scratchpad/Test_Label_0.class differ
index bacaa74..7810c7a 100644 (file)
Binary files a/tester/scratchpad/Test_NodeList_0$TestSuite.class and b/tester/scratchpad/Test_NodeList_0$TestSuite.class differ
index d812d47..93341aa 100644 (file)
Binary files a/tester/scratchpad/Test_NodeList_0.class and b/tester/scratchpad/Test_NodeList_0.class differ
index 004d6f8..e1692be 100644 (file)
Binary files a/tester/scratchpad/Test_Node_0$TestSuite.class and b/tester/scratchpad/Test_Node_0$TestSuite.class differ
index 145bb2e..b030bdf 100644 (file)
Binary files a/tester/scratchpad/Test_Node_0.class and b/tester/scratchpad/Test_Node_0.class differ
index bebcd71..73496bd 100644 (file)
Binary files a/tester/scratchpad/Test_TokenSet_0$TestSuite.class and b/tester/scratchpad/Test_TokenSet_0$TestSuite.class differ
index f3a164c..a52b931 100644 (file)
Binary files a/tester/scratchpad/Test_TokenSet_0.class and b/tester/scratchpad/Test_TokenSet_0.class differ
index ad30308..348ad80 100644 (file)
Binary files a/tester/scratchpad/Test_Token_0$TestSuite.class and b/tester/scratchpad/Test_Token_0$TestSuite.class differ
index 2d59086..e987e26 100644 (file)
Binary files a/tester/scratchpad/Test_Token_0.class and b/tester/scratchpad/Test_Token_0.class differ
index 615fee9..832bee5 100644 (file)
Binary files a/tester/scratchpad/Test_Util_0$TestSuite.class and b/tester/scratchpad/Test_Util_0$TestSuite.class differ
index 6b52ead..dfd8abf 100644 (file)
Binary files a/tester/scratchpad/Test_Util_0.class and b/tester/scratchpad/Test_Util_0.class differ