code: public static MathNode generateMathNode(Node applyRoot) {
          Objects.requireNonNull(applyRoot, "apply element is missing");
  
          MathNode mathNode = createMathNode(applyRoot, 0);
          // compute the maximum depth at least once after creation to define it for each branch.
          if (mathNode != null) {
              mathNode.getMaxDepth();
          }
          return mathNode;
      }
docs: Create a math expression tree (MEXT) starting from the root element of a
  Content MathML document.
  
  @param applyRoot root apply element of a CMML document.
  @return first MathNode representing the root of the MEXT