private void deleteNode(TrinaryTreeNode<T> node, T value)   
    {         
       int comparison = comparator.compare(value, node.getValue());
        if (comparison < 0)   
        {  
             
            if (node.getLeft() != null)   
            {  
                deleteNode(node.getLeft(), value);  
            }   
            
        }   
         
        else if (comparison > 0)   
        {  
            if (node.getRight() != null)   
            {  
                deleteNode(node.getRight(), value);  
            }   
            
        }  
       
        else  
        {  
            if (node.getMiddle() != null)   
            {  
                deleteNode(node.getMiddle(), value);  
            }   
            else   
            {
            	//delete this node
                clearNode(node);  
            }  
        }  
    }