//Fucntion for getting how many times a movie has been borrowed
 public void MovieCounter(string movieTitle)
 {
     if (root != null)
     {
         root.MovieCounter(movieTitle);
     }
 }
Ejemplo n.º 2
0
        //Fcuntion for getting how many times a movie has been borrowed
        public void MovieCounter(string movieTitle)
        {
            //If the movie equals the current node, get how many times it has been borrowed
            if (movie.getTitle() == movieTitle)
            {
                movie.Borrowed();
            }
            else
            {
                //If the left subtree ins't empty, search through it
                if (leftNode != null)
                {
                    leftNode.MovieCounter(movieTitle);
                }

                //If the right subtree isn't empty, search through it
                if (rightNode != null)
                {
                    rightNode.MovieCounter(movieTitle);
                }
            }
        }