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);
+ Ariadne_Node node = super.lookup_node(node_label);
if(node != null){
node.mark(new Ariadne_Token("cycle_member"));
} else{
}
Ariadne_Label it_node_label = path_stack.get(path_stack.size() - 1).get(0);
- Ariadne_Node it_node = super.lookup(it_node_label);
+ Ariadne_Node it_node = super.lookup_node(it_node_label);
if(it_node == null){
ret_value.add(new Ariadne_Token("undefined_node"));
return ret_value;
}
@Override
- public Ariadne_Node lookup(Ariadne_Label node_label, boolean verbose){
- Ariadne_Node node = super.lookup(node_label, verbose);
+ public Ariadne_Node lookup_node(Ariadne_Label node_label, boolean verbose){
+ Ariadne_Node node = super.lookup_node(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 node;
}
- public Ariadne_Node lookup(Ariadne_Label node_label){
- return lookup(node_label, this.debug);
+ public Ariadne_Node lookup_node(Ariadne_Label node_label){
+ return lookup_node(node_label, this.debug);
}
}
public Ariadne_StepRightMachine<Ariadne_Node> start();
public Ariadne_StepRightMachine<Ariadne_Node> traverse();
- public Ariadne_Node lookup(String label);
+ public Ariadne_Node lookup_node(String label);
}
IndexTree_Label root_label = IndexTree_Label.root();
read_list.add( root_label );
- IndexTree_Node root_node = lookup( root_label );
+ IndexTree_Node root_node = lookup_node( root_label );
breadth_srm.mount( root_node.neighbor() );
if( breadth_srm.can_read() ){
}
}
- private IndexTree_Node lookup( Ariadne_Label label ){
+ private IndexTree_Node lookup_node( Ariadne_Label label ){
return IndexTree_Node.make( (IndexTree_Label)label );
}
Ariadne_Label label = list_of__unopened_node.remove( 0 );
// Retrieve the node using lookup
- IndexTree_Node node = lookup( label );
+ IndexTree_Node node = lookup_node( label );
// Mount a new breadth-first TM_SR_ND for children
breadth_srm.mount( node.neighbor() );
Ariadne_Label label = child_list.remove( 0 );
read_list.add( label );
- IndexTree_Node node = lookup( label );
+ IndexTree_Node node = lookup_node( label );
breadth_srm.mount( node.neighbor() );
if( breadth_srm.can_read() ){
import com.ReasoningTechnology.Ariadne.Ariadne_TM_SR_ND_Array;
import com.ReasoningTechnology.Ariadne.Ariadne_TM_SR_ND_List;
-class TM_SR_ND_Depth extends Ariadne_TM_SR_ND{
+class TM_SR_ND_Depth extends Ariadne_TM_SR_ND<Label>{
// static
//
// instance data
//
protected Ariadne_Graph graph = null;
- protected List<Ariadne_TM_SR_ND> context_path = new ArrayList<>();
+ protected List<Ariadne_TM_SR_ND<Label>> context_path = new ArrayList<>();
protected Ariadne_Label cycle_node_label = null;
// constructor
Ariadne_TM_SR_ND child_srtm = null;
Ariadne_Label path_node_label = null;
- // context_path is known not to be empty, so can_read() is true
+ // context_path is known not to be empty, so can_read() is true
do{
child_srtm = context_path_srtm.read();
path_node_label = child_srtm.read();
Ariadne_Node path_node = null;
boolean is_leaf_node = false;
do{
- path_node = graph.lookup(path_node_label);
+ path_node = graph.lookup_node(path_node_label);
if(path_node == null){
System.out.println
(
}
// no override, this graph does not lookup Ariadne_Label, only Label
- @Override public Node lookup(Label label){
+ @Override public Node lookup_node(Label label){
return Node.make(label);
}
// Descend 3 more levels
int i = 1;
do{
- node = graph.lookup(label);
+ node = graph.lookup_node(label);
child_srm = node.neighbor();
label = child_srm.read();
System.out.println("Descended to: " + label.toString());
throw new UnsupportedOperationException("Ariadne_Graph::start.");
}
- public Ariadne_Node lookup(LT label){
+ public Ariadne_Node lookup_node(LT label){
throw new UnsupportedOperationException("Ariadne_Graph::lookup.");
}
+ public Ariadne_Node lookup_edge(LT label ,LT label){
+ throw new UnsupportedOperationException("Ariadne_Graph::lookup.");
+ }
+
+
}
Java, it is not clear that benefits of having a 'cleaner' implementation would
justify the work.
+4 add hash map to graph, lookup on node label pairs to find edge properties.
+
+5. append() method for TM_SR_ND.
Ariadne_GraphDirectedAcyclic graph = new Ariadne_GraphDirectedAcyclic(nodeMap, new Ariadne_ProductionList(), new Ariadne_LabelList());
- Ariadne_Node foundNode = graph.lookup(label, true);
+ Ariadne_Node foundNode = graph.lookup_node(label, true);
conditions[i++] = foundNode == node; // Expect to find the node
return Mosaic_Util.all(conditions);
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;
+ conditions[i++] = graph.lookup_node(label1, true) == node1;
+ conditions[i++] = graph.lookup_node(new Label("nonexistent"), true) == null;
io.clear_buffers(); // Clear after each case
return MU.all(conditions);
Graph graph = new Graph(nodeMap, new ProductionList());
// Perform lookup without verbosity
- Node result = graph.lookup(label, false);
+ Node result = graph.lookup_node(label, false);
conditions[i++] = result == node; // Expected to find node without verbose output
return MU.all(conditions);