Failed action adder
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_13" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -54,7 +54,7 @@ public class RecipeInstructions
|
|||||||
String[] words = split[1].split(" ");
|
String[] words = split[1].split(" ");
|
||||||
construct_children(newAction, words);
|
construct_children(newAction, words);
|
||||||
//we add the thing to the tree (this also needs to be checked for WHERE it gets added)
|
//we add the thing to the tree (this also needs to be checked for WHERE it gets added)
|
||||||
fullInstructions.addNode((RecipeNode) null, newAction);
|
fullInstructions.actionAdd(newAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,5 +130,19 @@ public class RecipeTree
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void actionAdd(RecipeNode actionNchild) {
|
||||||
|
if(root == null) {
|
||||||
|
root = actionNchild;
|
||||||
|
} else {
|
||||||
|
for(RecipeNode node : root.children) {
|
||||||
|
if(node.getPortion() != 0 || !actionNchild.getIngredient().equals(node.getIngredient())) {
|
||||||
|
actionAdd(actionNchild);
|
||||||
|
} else if(node.getPortion() == 0 && actionNchild.getIngredient().equals(node.getIngredient())) {
|
||||||
|
actionNchild.parent = node.parent;
|
||||||
|
node.parent = actionNchild;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user