public class AVLNode{ //Instance variables: private E element; private AVLNode left; private AVLNode right; int height; /**Creates a node with null references to its element and next node */ public AVLNode(){ this(null,null,null,0); } /** Creates a node with the given element and next node */ public AVLNode(E e, AVLNode l,AVLNode r,int h){ element = e; left=l; right=r; height=h; } /**copy constructor*/ public AVLNode(AVLNode p){ element=p.getElement(); left=p.getLeft(); right=p.getRight(); height=p.getHeight(); } public E getElement() { return element; } public void setElement(E element) { this.element = element; } public AVLNode getLeft() { return left; } public void setLeft(AVLNode left) { this.left = left; } public AVLNode getRight() { return right; } public void setRight(AVLNode right) { this.right = right; } public int getHeight(){ if (this==null) return -1; return height; } public void setHeight(int h){ this.height=h; } }