public class BTNode<E> implements BinNode<E> {
private E element;
private BTNode<E> left;
private BTNode<E> right;
public BTNode(){
left = right = null;
}
public BTNode(E val){
left = right = null;
element = val;
}
public BTNode(E val, BTNode<E> l, BTNode<E> r){
left = l;
right = r;
element = val;
}
public E value(){
return element;
}
public void setValue(E v){
element = v;
}
public BTNode<E> left(){
return left;
}
public void setLeft(BTNode<E> p){
left = p;
}
public BTNode<E> right(){
return right;
}
public void setRight(BTNode<E> p){
right = p;
}
public boolean isLeaf() {
return (left == null) && (right == null);
}
}