61 lines
1.2 KiB
Java
61 lines
1.2 KiB
Java
package tree;
|
|
|
|
import position.NodePositionList;
|
|
import position.Position;
|
|
import position.PositionList;
|
|
|
|
/**
|
|
* Created with xgiovio.macbookair.
|
|
* User: xgiovio
|
|
* Date: 07/04/14
|
|
* Time: 15:30
|
|
*/
|
|
public class TreeNode<E> implements TreePosition<E> {
|
|
|
|
private E element = null;
|
|
private TreePosition<E> parent = 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;
|
|
if (in_children != null){
|
|
children = in_children;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
public void setElement(E o) {
|
|
element = o;
|
|
}
|
|
|
|
@Override
|
|
public PositionList<Position<E>> getChildren() {
|
|
return children;
|
|
}
|
|
|
|
@Override
|
|
public void setChildren(PositionList<Position<E>> c) {
|
|
if (c != null){
|
|
children = c;
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public TreePosition<E> getParent() {
|
|
return parent;
|
|
}
|
|
|
|
@Override
|
|
public void setParent(TreePosition<E> v) {
|
|
parent = v;
|
|
}
|
|
|
|
@Override
|
|
public E element() {
|
|
return element;
|
|
}
|
|
}
|