Problem
, , , , Node DecidableTree. , DecidableTree Node, Node, .
, , , instanceOf, .
, Node . V , Node, T Node.
,
public abstract class Node<T, V> {
protected V value;
protected Node<T,V> parent;
private List<T> children;
public Node(V value){
this.value = value;
this.children = new ArrayList<T>();
}
public List<T> getChildren(){
return this.children;
}
public void addChild(T child){
this.children.add(child);
}
public V getVal(){
return this.value;
}
}
Node T , , , . , , DecidableTree , ,
public class DecidableTree<V> extends Node<DecidableTree<V>, V> {
public DecidableTree(V value) {
super(value);
}
public void randomInvolvedFunction(){
for(DecidableTree<V> child : this.getChildren()){
System.out.println(child.getVal());
}
}
}
DecidableTree - , T. , a T . .
, . . , .
Node , ArrayList - List , , . , Node , abstract. ArrayList, , List, ( - ). , .