/**
  * Add deprecated information to the documentation tree
  *
  * @param deprmembers list of deprecated members
  * @param headingKey the caption for the deprecated members table
  * @param tableSummary the summary for the deprecated members table
  * @param tableHeader table headers for the deprecated members table
  * @param contentTree the content tree to which the deprecated members table will be added
  */
 protected void addDeprecatedAPI(
     List<Doc> deprmembers,
     String headingKey,
     String tableSummary,
     String[] tableHeader,
     Content contentTree) {
   if (deprmembers.size() > 0) {
     Content caption = writer.getTableCaption(configuration.getResource(headingKey));
     Content table =
         (configuration.isOutputHtml5())
             ? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
             : HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption);
     table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
     Content tbody = new HtmlTree(HtmlTag.TBODY);
     for (int i = 0; i < deprmembers.size(); i++) {
       ProgramElementDoc member = (ProgramElementDoc) deprmembers.get(i);
       HtmlTree td = HtmlTree.TD(HtmlStyle.colOne, getDeprecatedLink(member));
       if (member.tags("deprecated").length > 0)
         writer.addInlineDeprecatedComment(member, member.tags("deprecated")[0], td);
       HtmlTree tr = HtmlTree.TR(td);
       if (i % 2 == 0) tr.addStyle(HtmlStyle.altColor);
       else tr.addStyle(HtmlStyle.rowColor);
       tbody.addContent(tr);
     }
     table.addContent(tbody);
     Content li = HtmlTree.LI(HtmlStyle.blockList, table);
     Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
     contentTree.addContent(ul);
   }
 }
 /**
  * Add the modifier and type for the member in the member summary.
  *
  * @param member the member to add the type for
  * @param type the type to add
  * @param tdSummaryType the content tree to which the modified and type will be added
  */
 protected void addModifierAndType(ProgramElementDoc member, Type type, Content tdSummaryType) {
   HtmlTree code = new HtmlTree(HtmlTag.CODE);
   addModifier(member, code);
   if (type == null) {
     if (member.isClass()) {
       code.addContent("class");
     } else {
       code.addContent("interface");
     }
     code.addContent(writer.getSpace());
   } else {
     if (member instanceof ExecutableMemberDoc
         && ((ExecutableMemberDoc) member).typeParameters().length > 0) {
       Content typeParameters =
           ((AbstractExecutableMemberWriter) this).getTypeParameters((ExecutableMemberDoc) member);
       code.addContent(typeParameters);
       // Code to avoid ugly wrapping in member summary table.
       if (typeParameters.charCount() > 10) {
         code.addContent(new HtmlTree(HtmlTag.BR));
       } else {
         code.addContent(writer.getSpace());
       }
       code.addContent(
           writer.getLink(
               new LinkInfoImpl(configuration, LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type)));
     } else {
       code.addContent(
           writer.getLink(
               new LinkInfoImpl(configuration, LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type)));
     }
   }
   tdSummaryType.addContent(code);
 }
 /**
  * Add use information to the documentation tree.
  *
  * @param mems list of program elements for which the use information will be added
  * @param heading the section heading
  * @param tableSummary the summary for the use table
  * @param contentTree the content tree to which the use information will be added
  */
 protected void addUseInfo(
     List<? extends ProgramElementDoc> mems,
     Content heading,
     String tableSummary,
     Content contentTree) {
   if (mems == null) {
     return;
   }
   List<? extends ProgramElementDoc> members = mems;
   boolean printedUseTableHeader = false;
   if (members.size() > 0) {
     Content caption = writer.getTableCaption(heading);
     Content table =
         (configuration.isOutputHtml5())
             ? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
             : HtmlTree.TABLE(HtmlStyle.useSummary, tableSummary, caption);
     Content tbody = new HtmlTree(HtmlTag.TBODY);
     Iterator<? extends ProgramElementDoc> it = members.iterator();
     for (int i = 0; it.hasNext(); i++) {
       ProgramElementDoc pgmdoc = it.next();
       ClassDoc cd = pgmdoc.containingClass();
       if (!printedUseTableHeader) {
         table.addContent(writer.getSummaryTableHeader(this.getSummaryTableHeader(pgmdoc), "col"));
         printedUseTableHeader = true;
       }
       HtmlTree tr = new HtmlTree(HtmlTag.TR);
       if (i % 2 == 0) {
         tr.addStyle(HtmlStyle.altColor);
       } else {
         tr.addStyle(HtmlStyle.rowColor);
       }
       HtmlTree tdFirst = new HtmlTree(HtmlTag.TD);
       tdFirst.addStyle(HtmlStyle.colFirst);
       writer.addSummaryType(this, pgmdoc, tdFirst);
       tr.addContent(tdFirst);
       HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
       tdLast.addStyle(HtmlStyle.colLast);
       if (cd != null && !(pgmdoc instanceof ConstructorDoc) && !(pgmdoc instanceof ClassDoc)) {
         HtmlTree name = new HtmlTree(HtmlTag.SPAN);
         name.addStyle(HtmlStyle.typeNameLabel);
         name.addContent(cd.name() + ".");
         tdLast.addContent(name);
       }
       addSummaryLink(
           pgmdoc instanceof ClassDoc ? LinkInfoImpl.Kind.CLASS_USE : LinkInfoImpl.Kind.MEMBER,
           cd,
           pgmdoc,
           tdLast);
       writer.addSummaryLinkComment(this, pgmdoc, tdLast);
       tr.addContent(tdLast);
       tbody.addContent(tr);
     }
     table.addContent(tbody);
     contentTree.addContent(table);
   }
 }
 /**
  * Add inherited member summary for the given class and member.
  *
  * @param classDoc the class the inherited member belongs to
  * @param nestedClass the inherited member that is summarized
  * @param isFirst true if this is the first member in the list
  * @param isLast true if this is the last member in the list
  * @param linksTree the content tree to which the summary will be added
  */
 public void addInheritedMemberSummary(
     ClassDoc classDoc,
     ProgramElementDoc nestedClass,
     boolean isFirst,
     boolean isLast,
     Content linksTree) {
   writer.addInheritedMemberSummary(this, classDoc, nestedClass, isFirst, linksTree);
 }
 /**
  * Add the deprecated information for the given member.
  *
  * @param member the member being documented.
  * @param contentTree the content tree to which the deprecated information will be added.
  */
 protected void addDeprecatedInfo(ProgramElementDoc member, Content contentTree) {
   Content output =
       (new DeprecatedTaglet()).getTagletOutput(member, writer.getTagletWriterInstance(false));
   if (!output.isEmpty()) {
     Content deprecatedContent = output;
     Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent);
     contentTree.addContent(div);
   }
 }
 /**
  * Add the member summary for the given class.
  *
  * @param classDoc the class that is being documented
  * @param member the member being documented
  * @param firstSentenceTags the first sentence tags to be added to the summary
  * @param tableContents the list of contents to which the documentation will be added
  * @param counter the counter for determining id and style for the table row
  */
 public void addMemberSummary(
     ClassDoc classDoc,
     ProgramElementDoc member,
     Tag[] firstSentenceTags,
     List<Content> tableContents,
     int counter) {
   HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
   tdSummaryType.addStyle(HtmlStyle.colFirst);
   writer.addSummaryType(this, member, tdSummaryType);
   HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
   setSummaryColumnStyle(tdSummary);
   addSummaryLink(classDoc, member, tdSummary);
   writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary);
   HtmlTree tr = HtmlTree.TR(tdSummaryType);
   tr.addContent(tdSummary);
   if (member instanceof MethodDoc && !member.isAnnotationTypeElement()) {
     int methodType =
         (member.isStatic()) ? MethodTypes.STATIC.value() : MethodTypes.INSTANCE.value();
     if (member.containingClass().isInterface()) {
       methodType =
           (((MethodDoc) member).isAbstract())
               ? methodType | MethodTypes.ABSTRACT.value()
               : methodType | MethodTypes.DEFAULT.value();
     } else {
       methodType =
           (((MethodDoc) member).isAbstract())
               ? methodType | MethodTypes.ABSTRACT.value()
               : methodType | MethodTypes.CONCRETE.value();
     }
     if (utils.isDeprecated(member) || utils.isDeprecated(classdoc)) {
       methodType = methodType | MethodTypes.DEPRECATED.value();
     }
     methodTypesOr = methodTypesOr | methodType;
     String tableId = "i" + counter;
     typeMap.put(tableId, methodType);
     tr.addAttr(HtmlAttr.ID, tableId);
   }
   if (counter % 2 == 0) tr.addStyle(HtmlStyle.altColor);
   else tr.addStyle(HtmlStyle.rowColor);
   tableContents.add(tr);
 }
 /**
  * Add the modifier for the member.
  *
  * @param member the member for which teh modifier will be added.
  * @param htmltree the content tree to which the modifier information will be added.
  */
 protected void addModifiers(MemberDoc member, Content htmltree) {
   String mod = modifierString(member);
   // According to JLS, we should not be showing public modifier for
   // interface methods.
   if ((member.isField() || member.isMethod())
       && writer instanceof ClassWriterImpl
       && ((ClassWriterImpl) writer).getClassDoc().isInterface()) {
     // This check for isDefault() and the default modifier needs to be
     // added for it to appear on the method details section. Once the
     // default modifier is added to the Modifier list on DocEnv and once
     // it is updated to use the javax.lang.model.element.Modifier, we
     // will need to remove this.
     mod =
         (member.isMethod() && ((MethodDoc) member).isDefault())
             ? utils.replaceText(mod, "public", "default").trim()
             : utils.replaceText(mod, "public", "").trim();
   }
   if (mod.length() > 0) {
     htmltree.addContent(mod);
     htmltree.addContent(writer.getSpace());
   }
 }
 /**
  * Get the member tree to be documented.
  *
  * @param memberTree the content tree of member to be documented
  * @return a content tree that will be added to the class documentation
  */
 public Content getMemberTree(Content memberTree) {
   return writer.getMemberTree(memberTree);
 }
 /**
  * Get the summary table tree for the given class.
  *
  * @param classDoc the class for which the summary table is generated
  * @param tableContents list of contents to be displayed in the summary table
  * @return a content tree for the summary table
  */
 public Content getSummaryTableTree(ClassDoc classDoc, List<Content> tableContents) {
   return writer.getSummaryTableTree(this, classDoc, tableContents, showTabs());
 }
 /**
  * Get the inherited summary header for the given class.
  *
  * @param classDoc the class the inherited member belongs to
  * @return a content tree for the inherited summary header
  */
 public Content getInheritedSummaryHeader(ClassDoc classDoc) {
   Content inheritedTree = writer.getMemberTreeHeader();
   writer.addInheritedSummaryHeader(this, classDoc, inheritedTree);
   return inheritedTree;
 }
 /**
  * Add the comment for the given member.
  *
  * @param member the member being documented.
  * @param htmltree the content tree to which the comment will be added.
  */
 protected void addComment(ProgramElementDoc member, Content htmltree) {
   if (member.inlineTags().length > 0) {
     writer.addInlineComment(member, htmltree);
   }
 }