implementazione di linked tree. manca il tostring

This commit is contained in:
2014-04-23 18:16:31 +02:00
parent b22cd894c1
commit 3607c918db
4 changed files with 188 additions and 32 deletions

View File

@@ -1,5 +1,6 @@
package tree;
import position.NodePositionList;
import position.Position;
import position.PositionList;
@@ -13,13 +14,15 @@ public class TreeNode<E> implements TreePosition<E> {
private E element = null;
private TreePosition<E> parent = null;
private PositionList<Position<E>> children= null;
private PositionList<Position<E>> children= new NodePositionList<Position<E>>();
public TreeNode(E in_element, TreePosition<E> in_parent, PositionList<Position<E>> in_children ){
element = in_element;
parent = in_parent;
children = in_children;
if (in_children != null){
children = in_children;
}
}
@@ -35,7 +38,9 @@ public class TreeNode<E> implements TreePosition<E> {
@Override
public void setChildren(PositionList<Position<E>> c) {
children = c;
if (c != null){
children = c;
}
}
@Override