package binary_tree;

public class BinaryNode<E> {
	
	// VARIABILI
	
	private BinaryNode<E> left, right, parent;
	private E data;
	
	// COSTRUTTORI
	
	public BinaryNode(E data) {
		this.data = data;
		
		left = right = parent = null;
	}
	
	public BinaryNode(BinaryNode<E> left, E data, BinaryNode<E> right) {
		this.data = data;
		
		this.left = left;
		this.right = right;
		
		this.parent = null;
		
		if (this.left != null) this.left.parent = this;
		if (this.right != null) this.right.parent = this;
	}
	
	// METODI
	
	public E getData() {
		return data;
	}
	
	public BinaryNode<E> getLeft() {
		return left;
	}
	
	public BinaryNode<E> getRight() {
		return right;
	}
	
	public BinaryNode<E> getParent() {
		return parent;
	}
	
	public boolean isRoot() {
		return parent == null;
	}
	
	public boolean isLeftChild() {
		
	}
	
}
