#ifndef AVL_H
#define AVL_H
#include "nodes.h"


class AVLTree{
	public:
	AVLTree():root(NULL){};
	/*FIXME TODO TODO TODO TODO remove silly copy ctor and operator=*/	
	AVLTree(const AVLTree& otherTree):root(NULL){
		cout << "bad programmers! Stop copy c'toring trees!" << endl;
		throw "bad programmers!";};	
	~AVLTree(){if (root) delete root;};
	AVLTree& operator=(const AVLTree& otherTree){
		cout << "bad programmers! Stop assigning trees!" << endl;
		throw "bad programmers!";};
	NodePtr Insert(BasicInfo& toInsert);
	NodePtr Find(const BasicInfo& toFind) const;
	void Remove(const BasicInfo& toRemove);	
	void RemoveByAdr(NodePtr toRemove);
	ostream& print(ostream& out) const; 
	NodePtr& getRoot(){return root;};
	void checkTree(NodePtr start){start->chBF(root);};
	float calcMedian(int medIndex)
		{return root->calcMedian(medIndex);};
	bool IsEmpty(){if(root) return false;
		return true;};
	float getMaxSal();
	private:
	NodePtr root;
};
	

ostream& operator<<(ostream& out, const AVLTree& toPrint);

#endif
