package binary_tree;

public class LinkedBinaryTree<E> implements BinaryTree<E>{
	
	// VARIABILI D'INSTANZA
	private BinaryNode<E> root;
	private int size;
	
	// Metodi costruttori
	public LinkedBinaryTree() {
		root = null;
		size = 0;
	}
	
	public LinkedBinaryTree(E data) {
		root = new BinaryNode<E>(data);
		size = 1;
	}
	
	public LinkedBinaryTree(LinkedBinaryTree<E> left, E data, LinkedBinaryTree<E> right) {
		root = new BinaryNode<E>(left.root, data, right.root);
		size = 1 + left.size + right.size;
	}
	
	// METODI
	
	public int size() {
		return size;
	}
	
	@Override
	public boolean isEmpty() {
		return root == null;
	}
	
	public E getRoot() {
		if (isEmpty()) return null;
		return root.getData();
	}
	
	public BinaryNode<E> getRootNode() {
		if (isEmpty()) return null;
	}
	
}
