almost working
This commit is contained in:
parent
a8d81fa9a4
commit
4d13bed110
|
@ -4,4 +4,6 @@ comment0.text=\r\n\ Blattknoten\ eines\ Entscheidungsbaums.\ Klassifiziert\ eine
|
|||
comment1.params=pClassification
|
||||
comment1.target=Classification(java.lang.String)
|
||||
comment1.text=\r\n\ Erstellt\ eine\ Klassifikation\r\n\r\n\ @param\ pClassification\ Name\ der\ Klasse\ (z.B.\ "Ja"\ oder\ "Nein")\r\n
|
||||
numComments=2
|
||||
comment2.params=pDataset
|
||||
comment2.target=java.lang.String\ decide(Dataset)
|
||||
numComments=3
|
||||
|
|
Binary file not shown.
|
@ -6,4 +6,6 @@ comment1.target=Decision(java.lang.String,\ java.lang.String)
|
|||
comment1.text=\r\n\ Erstellt\ eine\ bin\u00E4re\ Entscheidung.\r\n\r\n\ @param\ pAttribute\ Name\ des\ Attributs.\r\n\ @param\ pValueLeft\ Wert,\ wann\ im\ linken\ Teilbaum\ weitergesucht\ werden\ muss.\r\n
|
||||
comment2.params=pDataset
|
||||
comment2.target=java.lang.String\ decide(Dataset)
|
||||
numComments=3
|
||||
comment3.params=
|
||||
comment3.target=java.lang.String\ toString()
|
||||
numComments=4
|
||||
|
|
|
@ -35,5 +35,10 @@ public class Decision extends DecisionNode {
|
|||
return "right";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return attribute;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -2,7 +2,7 @@
|
|||
comment0.target=MorseTree
|
||||
comment1.params=
|
||||
comment1.target=void\ MorseTree()
|
||||
comment2.params=tree\ morse
|
||||
comment2.params=root\ morse
|
||||
comment2.target=void\ generateTree(BinaryTree,\ java.lang.String)
|
||||
comment3.params=
|
||||
comment3.target=void\ printHirarchical()
|
||||
|
|
|
@ -35,11 +35,12 @@ public class MorseTree {
|
|||
public void MorseTree() {
|
||||
|
||||
tree = new BinaryTree<>();
|
||||
tree.setContent(new Decision("", "."));
|
||||
generateTree(tree, "");
|
||||
|
||||
}
|
||||
|
||||
public void generateTree(BinaryTree<DecisionNode> tree, String morse) {
|
||||
public void generateTree(BinaryTree<DecisionNode> root, String morse) {
|
||||
String leftMorse = morse + ".";
|
||||
String rightMorse = morse + "-";
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
|
@ -47,12 +48,12 @@ public class MorseTree {
|
|||
BinaryTree<DecisionNode> leftTree = new BinaryTree<>();
|
||||
leftTree.setContent(new Decision(chars[i][0], "."));
|
||||
generateTree(leftTree, leftMorse);
|
||||
tree.setLeftTree(leftTree);
|
||||
root.setLeftTree(leftTree);
|
||||
} else if (chars[i][1].equals(rightMorse)) {
|
||||
BinaryTree<DecisionNode> rightTree = new BinaryTree<>();
|
||||
rightTree.setContent(new Decision(chars[i][0], "."));
|
||||
rightTree.setContent(new Decision(chars[i][0], "-"));
|
||||
generateTree(rightTree, rightMorse);
|
||||
tree.setRightTree(rightTree);
|
||||
root.setRightTree(rightTree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#BlueJ package file
|
||||
dependency1.from=Decision
|
||||
dependency1.from=Classification
|
||||
dependency1.to=Dataset
|
||||
dependency1.type=UsesDependency
|
||||
dependency2.from=DecisionNode
|
||||
|
@ -14,21 +14,24 @@ dependency4.type=UsesDependency
|
|||
dependency5.from=MorseTree
|
||||
dependency5.to=Decision
|
||||
dependency5.type=UsesDependency
|
||||
editor.fx.0.height=1000
|
||||
editor.fx.0.width=1296
|
||||
dependency6.from=Decision
|
||||
dependency6.to=Dataset
|
||||
dependency6.type=UsesDependency
|
||||
editor.fx.0.height=1026
|
||||
editor.fx.0.width=1696
|
||||
editor.fx.0.x=-8
|
||||
editor.fx.0.y=-8
|
||||
objectbench.height=93
|
||||
objectbench.width=1256
|
||||
objectbench.height=134
|
||||
objectbench.width=1656
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.8890122086570478
|
||||
package.editor.height=794
|
||||
package.editor.width=1145
|
||||
package.divider.vertical=0.847732181425486
|
||||
package.editor.height=778
|
||||
package.editor.width=1545
|
||||
package.editor.x=0
|
||||
package.editor.y=0
|
||||
package.frame.height=1000
|
||||
package.frame.width=1296
|
||||
package.numDependencies=5
|
||||
package.frame.height=1026
|
||||
package.frame.width=1696
|
||||
package.numDependencies=6
|
||||
package.numTargets=6
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
|
|
Loading…
Reference in New Issue