code: private TreeNode getParentTreeNode(TreeNode child) {
          TreeNode parentTreeNode = parentIndex.get(child);
  
          if (parentTreeNode == null)
              return null;
  
          // Makes sure the parent node is still present in the tree
          else if (contains(parentTreeNode.getQueryNode()))
              return parentTreeNode;
          else
              throw new RuntimeException("Internal error: points to a parent that is not (anymore) in the tree");
      }
docs: The returned value might be null.
  
  The point of this structure is to enforce the use of a TreeNode as argument.