<!--

     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
     regarding copyright ownership.  The ASF licenses this file
     to you under the Apache License, Version 2.0 (the
     "License"); you may not use this file except in compliance
     with the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing,
     software distributed under the License is distributed on an
     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.

-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- **************************************************************** -->
<!-- *  PLEASE KEEP COMPLICATED EXPRESSIONS OUT OF THESE TEMPLATES, * -->
<!-- *  i.e. only iterate & print data where possible. Thanks, Jez. * -->
<!-- **************************************************************** -->
<%
    def title = classDoc.name() + (props.docTitle ? " (${props.docTitle})" : "")
    def isVisible = { it.isPublic() || (it.isProtected() && props.protectedScope == 'true') || (!it.isProtected() && !it.isPrivate() && props.packageScope == 'true') || props.privateScope == 'true' }
    def isVisibleExt = { t -> java.lang.reflect.Modifier.isPublic(t.modifiers) || java.lang.reflect.Modifier.isProtected(t.modifiers) }
    def visibleFields = classDoc.fields().findAll(isVisible)
    def visibleProperties = classDoc.properties() // props visible be defn
    def visibleMethods = classDoc.methods().findAll(isVisible)
    def visibleConstructors = classDoc.constructors().findAll(isVisible)
    def visibleNested = classDoc.innerClasses().findAll(isVisible)
    boolean hasFields = !classDoc.isAnnotationType() && visibleFields
    boolean hasProperties = !classDoc.isAnnotationType() && visibleProperties
    boolean hasElements = classDoc.isAnnotationType() && visibleFields
    boolean methodSummaryShown = visibleMethods
    boolean fieldSummaryShown = hasFields
    boolean hasEnumConstants = classDoc.enumConstants()
    def dolink = { t, boolean b ->
        boolean isArray = false
        if (!t || t instanceof String) {
            return classDoc.getDocUrl(t, b)
        }
        if (t instanceof org.codehaus.groovy.tools.groovydoc.ArrayClassDocWrapper) {
            t = t.delegate
            isArray = true
        }
        if (t instanceof org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDoc) {
            if (t.fullPathName == 'def') return classDoc.getDocUrl("java.lang.Object def", b)
            if (!t.qualifiedTypeName().contains("<") && t.name().size() > 1)
                return "<a href='" + classDoc.relativeRootPath + t.fullPathName + ".html'>" + (b ? t.qualifiedTypeName() : t.name()) + "</a>" + (isArray ? "[]" : "")
        }
        return classDoc.getDocUrl(t.qualifiedTypeName(), b) + (isArray ? "[]" : "")
    }
    def linkfull = { t -> dolink(t, true) }
    def linkable = { t -> dolink(t, false) }
    def modifiersWithOptions = { t, boolean ignorePublic, boolean ignoreAbstract, boolean ignoreFinal=false, boolean ignoreStatic=false ->
        (t.isPrivate()?"private&nbsp;":"") +
        (t.isPublic() && !ignorePublic?"public&nbsp;":"") +
        (t.isProtected()?"protected&nbsp;":"") +
        (t.isStatic() && !ignoreStatic ?"static&nbsp;":"") +
        (t.isFinal() && !ignoreFinal?"final&nbsp;":"") +
        (!ignoreAbstract && t.respondsTo('isAbstract') && t.isAbstract()?"abstract&nbsp;":"")
    }
    def modifiers = { t -> modifiersWithOptions(t, classDoc.isGroovy(), false) }
    def modifiersBrief = { t ->
        (t.isPrivate()?"private&nbsp;":"") +
        (t.isProtected()?"protected&nbsp;":"") +
        (t.isStatic()?"static&nbsp;":"")
    }
    def annotations = { t, sepChar ->
        t.annotations() ? t.annotations().collect{ it.isTypeAvailable()?'@'+linkable(it.type().typeName())+it.description():'@'+it.name()+it.description()}.join(sepChar) + sepChar : ''
    }
    def elementTypes = [
        "required":"true",
        "optional":"false"
    ]
    def isRequired = { f, v -> def req = f.constantValueExpression() == null; req.toString() == v }
    def upcase = { n -> n[0].toUpperCase() + n[1..-1] }
    def paramsOf = { n, boolean brief -> n.parameters().collect{ param -> (brief?'':annotations(param, '<br>')) + linkable(param.isTypeAvailable()?param.type():param.typeName()) + (param.vararg()?'... ':' ') + param.name() + (param.defaultValue() ? " = " + param.defaultValue():"") }.join(", ") }
    def rawType = { n -> def g = n.indexOf("<"); g >= 0 ? n.substring(0, g) : n }
    def nameFromParams = { n -> n.name() + '(' + n.parameters().collect{ param -> rawType(param.isTypeAvailable()?param.type().qualifiedTypeName():param.typeName()) }.join(', ') + ')' }
    def nameFromJavaParams = { n -> n.getName() + '(' + n.parameterTypes.collect{ param -> param.getName() }.join(', ') + ')' }
%>
<html>
<head>
    <!-- Generated by groovydoc<% if (props.versionStamp != 'false') { %> (${GroovySystem.version})<% } %><% if (props.timestamp != 'false') { %> on ${new Date()}<% } %> -->
    <title>${title}</title>
    <% if (props.timestamp != 'false') { %><meta name="date" content="${new java.text.SimpleDateFormat('yyyy-MM-dd').format(new Date())}"><% } %>
    <meta http-equiv="Content-Type" content="text/html; charset=${props.charset}">
    <link href="${classDoc.relativeRootPath}groovy.ico" type="image/x-icon" rel="shortcut icon">
    <link href="${classDoc.relativeRootPath}groovy.ico" type="image/x-icon" rel="icon">
    <link rel="stylesheet" type="text/css" href="${classDoc.relativeRootPath}stylesheet.css" title="Style">

<body class="center">
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
    parent.document.title="${title}";
}
//-->
</script>
<noscript>
    <div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
    <!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
    <!--   -->
</a>
    <ul class="navList" title="Navigation">
        <li><a href="${classDoc.relativeRootPath}overview-summary.html">Overview</a></li>
        <li><a href="package-summary.html">Package</a></li>
        <li class="navBarCell1Rev">Class</li>
        <li><a href="${classDoc.relativeRootPath}deprecated-list.html">Deprecated</a></li>
        <li><a href="${classDoc.relativeRootPath}index-all.html">Index</a></li>
        <li><a href="${classDoc.relativeRootPath}help-doc.html">Help</a></li>
    </ul>
</div>

<div class="subNav">
    <div>
        <ul class="navList">
            <li><a href="${classDoc.relativeRootPath}index.html?${classDoc.fullPathName}" target="_top">Frames</a></li>
            <li><a href="${classDoc.name()}.html" target="_top">No Frames</a></li>
        </ul>
    </div>
    <div>
        <ul class="subNavList">
            <li>Summary:&nbsp;</li>
            <%
    if (classDoc.isAnnotationType()) {
        def hasReq = classDoc.fields().any{ isRequired(it, "true") }
        def hasOpt = classDoc.fields().any{ isRequired(it, "false") }
        if (hasReq) { %><li><a href="#required_element_summary"><% } %>Required<% if (hasReq) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
        if (hasOpt) { %><li><a href="#optional_element_summary"><% } %>Optional<% if (hasOpt) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
    } else {
        if (visibleNested) { %><li><a href="#nested_summary"><% } %>Nested<% if (visibleNested) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
        if (classDoc.isEnum()) {
            if (hasEnumConstants) { %><li><a href="#enum_constant_summary"><% } %>Enum constants<% if (hasEnumConstants) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
        }
        if (hasFields) { %><li><a href="#field_summary"><% } %>Field<% if (hasFields) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
        if (hasProperties) { %><li><a href="#property_summary">Property</a></li><% } %>&nbsp;&nbsp;&nbsp;<%
        if (classDoc.isClass()) {
            if (visibleConstructors) { %><li><a href="#constructor_summary"><% } %>Constructor<% if (visibleConstructors) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
        }
        if (visibleMethods) { %><li><a href="#method_summary"><% } %>Method<% if (visibleMethods) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
    }
    %>
        </ul>
        <ul class="subNavList">
            <li>&nbsp;|&nbsp;Detail:&nbsp;</li>
            <%
            if (classDoc.isAnnotationType()) {
                if (hasElements) { %><li><a href="#element_detail"><% } %>Element<% if (hasElements) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
            } else {
                if (classDoc.isEnum()) {
                    if (hasEnumConstants) { %><li><a href="#enum_constant_detail"><% } %>Enum constants<% if (hasEnumConstants) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
                }
                if (hasFields) { %><li><a href="#field_detail"><% } %>Field<% if (hasFields) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
                if (hasProperties) { %><li><a href="#prop_detail">Property</a></li><% } %>&nbsp;&nbsp;&nbsp;<%
                if (classDoc.isClass()) {
                    if (visibleConstructors) { %><li><a href="#constructor_detail"><% } %>Constructor<% if (visibleConstructors) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
                }
                if (visibleMethods) { %><li><a href="#method_detail"><% } %>Method<% if (visibleMethods) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
            }
            %>
        </ul>
    </div>
    <a name="skip-navbar_top">
        <!--   -->
    </a></div>
<!-- ========= END OF TOP NAVBAR ========= -->

<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<%
def pkg = classDoc.containingPackage().nameWithDots()
def name = classDoc.getNameWithTypeArgs() ?: classDoc.name()
final nameEncoded = org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDoc.encodeAngleBrackets(name)
String classDesc = "${classDoc.isGroovy() ? "[Groovy]" : "[Java]"} ${classDoc.typeDescription} $nameEncoded"
if (pkg != "DefaultPackage") {
%>
    <div class="subTitle">Package: <strong>${pkg}</strong></div>
<%}%>
    <h2 title="${classDesc}" class="title">${classDesc}</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<%
def parents = classDoc.isInterface() ? classDoc.parentInterfaces : classDoc.parentClasses
if (parents.size() >= 2) {
    parents.eachWithIndex { p, i ->
        %><li><%
        if ( i == parents.size() - 1) {
            out << p.qualifiedTypeName()
        } else {
            %><ul class="inheritance"><% linkfull(p) %></ul></li><%
        }
    }
}
%>
</ul>
<div class="description">
    <ul class="blockList">
        <li class="blockList">
<%
if (classDoc.isInterface()) {
    Set interfaces = classDoc.parentInterfaces
    interfaces -= classDoc
    if (interfaces) {
        %>
            <dl>
                <dt>All Superinterfaces:</dt>
                <dd>${interfaces.collect{ linkable(it) }.join(', ')}</dd>
            </dl><%
    }
} else {
    // TODO follow up the tree collecting interfaces seen?
    def interfaces = classDoc.interfaces()
    if (interfaces) {
        %>
            <dl>
                <dt>All Implemented Interfaces and Traits:</dt>
                <dd>${interfaces.collect{ linkable(it) }.join(', ')}</dd>
            </dl>
    <% } %>
<% } %>
            <!-- todo: direct known subclasses -->
            <hr>
<%
def declaration = annotations(classDoc, '\n') +
    modifiersWithOptions(classDoc, classDoc.isGroovy(), classDoc.isInterface() || classDoc.isAnnotationType(), classDoc.isEnum(), false) +
    classDoc.typeSourceDescription +
    " ${nameEncoded}"
final interfaces = classDoc.interfaces().collect{ linkable(it) }.join(', ')
if (classDoc.isInterface() && classDoc.interfaces()) {
    if (interfaces) {
        declaration += "\nextends $interfaces"
    }
} else if (classDoc.superclass()) {
    declaration += "\nextends ${linkable(classDoc.superclass())}"
    if (interfaces) {
        declaration += "\nimplements $interfaces"
    }
}
%>
<pre>${declaration?.replace('&nbsp;', ' ')}</pre>
<% if (classDoc.commentText()) { %>
    <p>${classDoc.commentText()}</p>
<% } %>
          </li>
    </ul>
</div>

<div class="summary">
    <ul class="blockList">
        <li class="blockList">
        <!-- =========== NESTED CLASS SUMMARY =========== -->
        <% if (visibleNested) { %>
            <ul class="blockList">
                <li class="blockList"><a name="nested_summary"><!--   --></a>
                    <h3>Nested Class Summary</h3>
                    <ul class="blockList">
                    <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
                        <caption><span>Nested classes</span><span class="tabEnd">&nbsp;</span></caption>
                        <tr>
                            <th class="colFirst" scope="col">Modifiers</th>
                            <th class="colLast" scope="col">Name</th>
                            <th class="colLast" scope="col">Description</th>
                        </tr>
                        <% visibleNested.eachWithIndex { c, i -> %>
                        <tr class="${i%2==0?'altColor':'rowColor'}">
                            <td class="colFirst"><code><strong>${modifiersBrief(c) + c.typeSourceDescription}</strong></code>&nbsp;</td>
                            <td class="colLast"><code>${linkable(c)}</code></td>
                            <td class="colLast">${c.firstSentenceCommentText()}</td>
                        </tr>
                        <% } %>
                    </table>
                   </ul>
                </li>
            </ul>
        <% } %>

        <!-- =========== ENUM CONSTANT SUMMARY =========== -->
        <% if (hasEnumConstants) { %>
            <ul class="blockList">
                <li class="blockList"><a name="enum_constant_summary"><!--   --></a>
                    <h3>Enum Constants Summary</h3>
                    <ul class="blockList">
                    <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Enum constants summary table">
                        <caption><span>Enum constants classes</span><span class="tabEnd">&nbsp;</span></caption>
                        <tr>
                            <th class="colFirst" scope="col">Enum constant</th>
                            <th class="colLast" scope="col">Description</th>
                        </tr>
                        <% classDoc.enumConstants().eachWithIndex { ec, i -> %>
                        <tr class="${i%2==0?'altColor':'rowColor'}">
                            <td class="colFirst"><code><strong><a href="#${ec.name()}">${ec.name()}</a></strong></code></td>
                            <td class="colLast">${ec.firstSentenceCommentText()}</td>
                        </tr>
                        <% } %>
                    </table>
                   </ul>
                </li>
            </ul>
        <% } %>
        <!-- =========== FIELD SUMMARY =========== -->
        <%
        def buffer = new StringBuilder()
        def propBuffer = new StringBuilder()
        classes = []
        if (classDoc.isInterface()) {
            classes.addAll(classDoc.interfaces().toList())
        } else {
            if (classDoc.superclass()) classes += classDoc.superclass()
            else classes += new org.codehaus.groovy.tools.groovydoc.ExternalGroovyClassDoc(Object.class)
        }
        visited = [classDoc] as Set
        while (classes) {
            Set nextLevel = []
            classes.eachWithIndex { c,i ->
                if (c.isInterface()) nextLevel.addAll(c.interfaces().toList())
                else if (c.superclass() && c.qualifiedTypeName() != 'java.lang.Object') nextLevel += c.superclass()
                nextLevel -= visited
                visited += nextLevel
                def list = []
                if (c instanceof org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDoc) {
                    list = c.fields().findAll(isVisible).collect { field ->
                        "<a href='${classDoc.relativeRootPath}${c.fullPathName}.html#${field.name()}'>${field.name()}</a>"
                    }
                } else {
                    list = c.externalClass().fields.findAll{ isVisibleExt(it) }.collect { field ->
                        // "<a href='${classDoc.relativeRootPath}${c.fullPathName}.html#${field.name()}'>${field.name()}</a>"
                        field.name
                    }
                }
                if (list) {
                    buffer << """                        <tr class="${i%2==0?'altColor':'rowColor'}">
                            <td class="colFirst"><strong><code>${c.typeSourceDescription} ${linkable(c)}</code></strong></td>
                            <td class="colLast"><code>${list.join(', ')}</code></td>
                        </tr>
"""
                }

                list = []
                list = c.properties().collect { prop ->
                        "<a href='${classDoc.relativeRootPath}${c.fullPathName}.html#${prop.name()}'>${prop.name()}</a>"
                        prop.name()
                }
                if (list) {
                    propBuffer << """                        <tr class="${i%2==0?'altColor':'rowColor'}">
                                <td class="colFirst"><strong><code>${c.typeSourceDescription} ${linkable(c)}</code></strong></td>
                                <td class="colLast"><code>${list.join(', ')}</code></td>
                            </tr>
"""
                }
            }
            classes = nextLevel
        }


        if (hasFields || buffer.length()>0) { %>
            <ul class="blockList"><%
                if (hasFields) { %>
                <li class="blockList"><a name="field_summary"><!--   --></a>
                    <h3>Field Summary</h3>
                    <ul class="blockList">
                    <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Enum constants summary table">
                        <caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
                        <tr>
                            <th class="colFirst" scope="col">Modifiers</th>
                            <th class="colLast" scope="col">Name</th>
                            <th class="colLast" scope="col">Description</th>
                        </tr>
                        <% visibleFields.eachWithIndex { field, i -> %>
                        <tr class="${i%2==0?'altColor':'rowColor'}">
                            <td class="colFirst"><code><strong>${modifiersBrief(field) + linkable(field.type())}</strong></code>&nbsp;</td>
                            <td class="colLast"><code><a href="#${field.name()}">${field.name()}</a></code></td>
                            <td class="colLast">${field.firstSentenceCommentText()}</td>
                        </tr>
                        <% } %>
                    </table>
                   </ul>
                </li>
                <% } // if (hasFields)
                if ((buffer.length())>0) { %>
                <li class="blockList"><a name="field_summary"><!--   --></a>
                    <ul class="blockList">
                    <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Inherited fields summary table">
                        <caption><span>Inherited fields</span><span class="tabEnd">&nbsp;</span></caption>
                        <tr>
                            <th class="colFirst" scope="col">Fields inherited from class</th>
                            <th class="colLast" scope="col">Fields</th>
                        </tr>
                        ${buffer}
                    </table>
                    </ul>
                </li>
                <% } // if buffer %>
            </ul>
        <% } // if hasFields or buffer %>

        <!-- =========== PROPERTY SUMMARY =========== -->
        <% if (hasProperties || propBuffer.length()>0) { %>
         <ul class="blockList"> <%
                if (hasProperties) { %>
                <li class="blockList"><a name="property_summary"><!--   --></a>
                    <h3>Properties Summary</h3>
                    <ul class="blockList">
                    <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties Summary table, listing nested classes, and an explanation">
                        <caption><span>Properties</span><span class="tabEnd">&nbsp;</span></caption>
                        <tr>
                            <th class="colFirst" scope="col">Type</th>
                            <th class="colLast" scope="col">Name and description</th>
                        </tr>
                        <% visibleProperties.eachWithIndex { prop, i -> %>
                        <tr class="${i%2==0?'altColor':'rowColor'}">
                            <td class="colFirst"><code><strong>${modifiersBrief(prop) + linkable(prop.type())}</strong></code>&nbsp;</td>
                            <td class="colLast"><code><a href="#${prop.name()}">${prop.name()}</a></code><br>${prop.firstSentenceCommentText()}</td>
                        </tr>
                        <% } %>
                    </table>
                   </ul>
                </li>
                <% } // if hasProperties

                 if (propBuffer.length()>0) { %>
                 <li class="blockList"><a name="properties_summary"><!--   --></a>
                     <ul class="blockList">
                         <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Inherited properties summary table">
                             <caption><span>Inherited properties</span><span class="tabEnd">&nbsp;</span></caption>
                             <tr>
                                 <th class="colFirst" scope="col">Properties inherited from class</th>
                                 <th class="colLast" scope="col">Properties</th>
                             </tr>
                             ${propBuffer}
                         </table>
                     </ul>
                 </li>
                 <% } // if propBuffer %>
            </ul>
        <% } // if hasProperties or propBuffer %>

        <!-- =========== ELEMENT SUMMARY =========== -->
        <% if (hasElements) { %>
        <ul class="blockList"><a name="element_summary"><!--   --></a>
                <li class="blockList">
                    <h3>Element Summary</h3>
                    <% elementTypes.each { k, v ->
                    %><a name="${k}_element_summary"><!--   --></a><%
                        if (visibleFields.any{ isRequired(it, v) }) {  %>
                    <ul class="blockList">
                    <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="${upcase(k)} Element Summary table">
                        <caption><span>${upcase(k)} Element Summary</span><span class="tabEnd">&nbsp;</span></caption>
                        <tr>
                            <th class="colFirst" scope="col">Type</th>
                            <th class="colLast" scope="col">Name and Description</th>
                        </tr>
                        <% visibleFields.findAll {isRequired(it, v)}.eachWithIndex { element, i -> %>
                        <tr class="${i%2==0?'altColor':'rowColor'}">
                            <td class="colFirst"><code><strong>${modifiersBrief(element) + linkable(element.type())}</strong></code>&nbsp;</td>
                            <td class="colLast"><code><a href="#${element.name()}">${element.name()}</a></code><br>${element.firstSentenceCommentText()}</td>
                        </tr>
                        <% } %>
                    </table>
                   </ul>
                   <% }
                   } //elementTypes.each %>
                </li>
        </ul>
        <% } %>

        <% if (visibleConstructors) { %>
        <!-- ======== CONSTRUCTOR SUMMARY ======== -->
        <ul class="blockList">
                <li class="blockList"><a name="constructor_summary"><!--   --></a>
                    <h3>Constructor Summary</h3>
                    <ul class="blockList">
                    <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructors Summary table">
                        <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
                        <tr>
                            <th class="colFirst" scope="col">Constructor and description</th>
                        </tr>
                        <% visibleConstructors.eachWithIndex { constructor, i -> %>
                        <tr class="${i%2==0?'altColor':'rowColor'}">
                            <td class="colFirst">
                                <code>${modifiersBrief(constructor)}<strong><a href="#${nameFromParams(constructor)}">${constructor.name()}</a></strong>(${paramsOf(constructor, true)})</code><br>${constructor.firstSentenceCommentText()}</td>
                        </tr>
                        <% } %>
                    </table>
                   </ul>
              </li>
        </ul>
        <% } %>

        <%
        buffer = new StringBuilder()
        Set classes = []
        if (classDoc.isInterface()) {
            classes.addAll(classDoc.interfaces().toList())
        } else {
            if (classDoc.superclass()) classes += classDoc.superclass()
            else if (!classDoc.isTrait()) classes += new org.codehaus.groovy.tools.groovydoc.ExternalGroovyClassDoc(Object.class)
        }
        Set visited = [classDoc] as Set
        while (classes) {
            Set nextLevel = []
            classes.eachWithIndex { c,i ->
                if (c.isInterface()) nextLevel.addAll(c.interfaces().toList())
                else if (c.superclass() && c.qualifiedTypeName() != 'java.lang.Object') nextLevel += c.superclass()
                nextLevel -= visited
                visited += nextLevel
                def list = []
                if (c instanceof org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDoc) {
                    list = c.methods().findAll(isVisible).collect { method ->
                        "<a href='${classDoc.relativeRootPath}${c.fullPathName}.html#${nameFromParams(method)}'>${method.name()}</a>"
                    }
                } else {
                    list = c.externalClass().methods.findAll{ isVisibleExt(it) }.collect { method ->
                        linkable(c.externalClass().name + "#" + nameFromJavaParams(method) + " " + method.name)
                    }
                }
                if (list) {
                    buffer << """
                        <tr class="${i%2==0?'altColor':'rowColor'}">
                            <td class="colFirst"><code>${c.typeSourceDescription} ${linkable(c)}</code></td>
                            <td class="colLast"><code>${list.join(', ')}</code></td>
                        </tr>"""
                }
            }
            classes = nextLevel
        }

        if (visibleMethods || buffer.length()>0) { %>
        <!-- ========== METHOD SUMMARY =========== -->
        <ul class="blockList">
            <% if (visibleMethods) { %>
            <li class="blockList"><a name="method_summary"><!--   --></a>
                    <h3>Methods Summary</h3>
                    <ul class="blockList">
                    <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Methods Summary table">
                        <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
                        <tr>
                            <th class="colFirst" scope="col">Type Params</th>
                            <th class="colLast" scope="col">Return Type</th>
                            <th class="colLast" scope="col">Name and description</th>
                        </tr>
                        <% visibleMethods.eachWithIndex { method, i -> %>
                        <tr class="${i%2==0?'altColor':'rowColor'}">
                            <td class="colFirst"><code>${org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDoc.encodeAngleBrackets(method.typeParameters()) ?: ''}</code></td>
                            <td class="colLast"><code>${modifiers(method)}${linkable(method.returnType())}</code></td>
                            <td class="colLast"><code><strong><a href="#${nameFromParams(method)}">${method.name()}</a></strong>(${paramsOf(method, true)})</code><br>${method.firstSentenceCommentText()}</td>
                        </tr>
                        <% } %>
                    </table>
                   </ul>
              </li>
            <% } // if (visibleMethods)
            if (buffer.length()>0) {
                %>
            <li class="blockList"><a name="method_summary"><!--   --></a>
                    <h3>Inherited Methods Summary</h3>
                    <ul class="blockList">
                    <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Inherited Methods Summary table">
                        <caption><span>Inherited Methods</span><span class="tabEnd">&nbsp;</span></caption>
                        <tr>
                            <th class="colFirst" scope="col">Methods inherited from class</th>
                            <th class="colLast" scope="col">Name</th>
                        </tr>
                        ${buffer}
                    </table>
                   </ul>
              </li>
                <%
            } // if buffer.length%>
        </ul>
        <% } %>
    </li>
    </ul>
</div>

<div class="details">
    <ul class="blockList">
        <li class="blockList">
           <% if (hasEnumConstants) { %>
            <!-- ============ ENUM CONSTANT DETAIL ========== -->
            <ul class="blockList">
                <li class="blockList"><a name="enum_constant_detail">
                    <!--   -->
                </a>
                    <h3>Enum Constant Detail</h3>
                    <% for (ec in classDoc.enumConstants()) { %>
                        <a name="${ec.name()}"><!-- --></a>
                        <ul class="blockListLast">
                            <li class="blockList">
                                <h4>${annotations(ec, '<br>') + modifiersWithOptions(ec, true, true, true, true) + '<a href="' + classDoc.relativeRootPath + classDoc.fullPathName + '.html">' + classDoc.name() + '</a>'} <strong>${ec.name()}</strong></h4>
                                <p>${ec.commentText()}</p>
                            </li>
                        </ul>
                    <% } %>
                </li>
            </ul>
            <% } %>

            <% if (hasFields) { %>
            <!-- =========== FIELD DETAIL =========== -->
            <ul class="blockList">
                <li class="blockList"><a name="field_detail">
                    <!--   -->
                </a>
                    <h3>Field Detail</h3>
                    <% visibleFields.each { field -> %>
                        <a name="${field.name()}"><!-- --></a>
                        <ul class="blockListLast">
                            <li class="blockList">
                                <h4>${annotations(field, '<br>') + modifiersWithOptions(field, false, false) + linkable(field.type())} <strong>${field.name()}</strong></h4>
                                <p>${field.commentText()}</p>
                            </li>
                        </ul>
                    <% } %>
                </li>
            </ul>
            <% } %>

            <% if (hasProperties) { %>
            <!-- =========== PROPERTY DETAIL =========== -->
            <ul class="blockList">
                <li class="blockList"><a name="prop_detail">
                    <!--   -->
                </a>
                    <h3>Property Detail</h3>
                    <% visibleProperties.each { prop -> %>
                        <a name="${prop.name()}"><!-- --></a>
                        <ul class="blockListLast">
                            <li class="blockList">
                                <h4>${annotations(prop, '<br>') + modifiers(prop) + linkable(prop.type())} <strong>${prop.name()}</strong></h4>
                                <p>${prop.commentText()}</p>
                            </li>
                        </ul>
                    <% } %>
                </li>
            </ul>
            <% } %>

            <% if (hasElements) { %>
            <!-- =========== ELEMENT DETAIL =========== -->
            <ul class="blockList">
                <li class="blockList"><a name="element_detail">
                    <!--   -->
                </a>
                    <h3>Element Detail</h3>
                    <% visibleFields.each { element -> %>
                        <a name="${element.name()}"><!-- --></a>
                        <ul class="blockListLast">
                            <li class="blockList">
                                <h4>${modifiers(element) + linkable(element.type())} <strong>${element.name()}</strong></h4>
                                <p>${element.commentText()}</p>
                            </li>
                        </ul>
                    <% } %>
                </li>
            </ul>
            <% } %>

            <% if (visibleConstructors) { %>
            <!-- =========== CONSTRUCTOR DETAIL =========== -->
            <ul class="blockList">
                <li class="blockList"><a name="constructor_detail">
                    <!--   -->
                </a>
                    <h3>Constructor Detail</h3>
                    <% visibleConstructors.each { constructor -> %>
                        <a name="${nameFromParams(constructor)}"><!-- --></a>
                        <ul class="blockListLast">
                            <li class="blockList">
                                <h4>${annotations(constructor, '<br>') + modifiers(constructor)}<strong>${constructor.name()}</strong>(${paramsOf(constructor, false)})</h4>
                                <p>${constructor.commentText()}</p>
                            </li>
                        </ul>
                    <% } %>
                </li>
            </ul>
            <% } %>


            <% if (visibleMethods) { %>
            <!-- =========== METHOD DETAIL =========== -->
            <ul class="blockList">
                <li class="blockList"><a name="method_detail">
                    <!--   -->
                </a>
                    <h3>Method Detail</h3>
                    <% visibleMethods.each { method -> %>
                        <a name="${nameFromParams(method)}"><!-- --></a>
                        <ul class="blockListLast">
                            <li class="blockList">
                                <h4>${method.typeParameters() ?
                                    org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDoc.encodeAngleBrackets(method.typeParameters()) + ' ' : ''}${annotations(method, '<br>') + modifiers(method)}${linkable(method.returnType())} <strong>${method.name()}</strong>(${paramsOf(method, false)})</h4>
                                <p>${method.commentText()}</p>
                            </li>
                        </ul>
                    <% } %>
                </li>
            </ul>
            <% } %>
        </li>
    </ul>
</div>

<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
    <!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
    <!--   -->
</a>
    <ul class="navList" title="Navigation">
        <li><a href="${classDoc.relativeRootPath}overview-summary.html">Overview</a></li>
        <li><a href="package-summary.html">Package</a></li>
        <li class="navBarCell1Rev">Class</li>
        <li><a href="${classDoc.relativeRootPath}deprecated-list.html">Deprecated</a></li>
        <li><a href="${classDoc.relativeRootPath}index-all.html">Index</a></li>
        <li><a href="${classDoc.relativeRootPath}help-doc.html">Help</a></li>
    </ul>
</div>

<div class="subNav">
    <div>
        <ul class="navList">
            <li><a href="${classDoc.relativeRootPath}index.html?${classDoc.fullPathName}" target="_top">Frames</a></li>
            <li><a href="${classDoc.name()}.html" target="_top">No Frames</a></li>
        </ul>
    </div>
    <div>
        <ul class="subNavList">
            <li>Summary:&nbsp;</li>
            <%
    if (classDoc.isAnnotationType()) {
        def hasReq = classDoc.fields().any{ isRequired(it, "true") }
        def hasOpt = classDoc.fields().any{ isRequired(it, "false") }
        if (hasReq) { %><li><a href="#required_element_summary"><% } %>Required<% if (hasReq) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
        if (hasOpt) { %><li><a href="#optional_element_summary"><% } %>Optional<% if (hasOpt) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
    } else {
        if (visibleNested) { %><li><a href="#nested_summary"><% } %>Nested<% if (visibleNested) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
        if (classDoc.isEnum()) {
            if (hasEnumConstants) { %><li><a href="#enum_constant_summary"><% } %>Enum constants<% if (hasEnumConstants) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
        }
        if (hasFields) { %><li><a href="#field_summary"><% } %>Field<% if (hasFields) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
        if (hasProperties) { %><li><a href="#property_summary">Property</a></li><% } %>&nbsp;&nbsp;&nbsp;<%
        if (classDoc.isClass()) {
            if (visibleConstructors) { %><li><a href="#constructor_summary"><% } %>Constructor<% if (visibleConstructors) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
        }
        if (visibleMethods) { %><li><a href="#method_summary"><% } %>Method<% if (visibleMethods) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
    }
    %>
        </ul>
        <ul class="subNavList">
            <li>&nbsp;|&nbsp;Detail:&nbsp;</li>
            <%
            if (classDoc.isAnnotationType()) {
                if (hasElements) { %><li><a href="#element_detail"><% } %>Element<% if (hasElements) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
            } else {
                if (classDoc.isEnum()) {
                    if (hasEnumConstants) { %><li><a href="#enum_constant_detail"><% } %>Enum constants<% if (hasEnumConstants) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
                }
                if (hasFields) { %><li><a href="#field_detail"><% } %>Field<% if (hasFields) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
                if (hasProperties) { %><li><a href="#prop_detail">Property</a></li><% } %>&nbsp;&nbsp;&nbsp;<%
                if (classDoc.isClass()) {
                    if (visibleConstructors) { %><li><a href="#constructor_detail"><% } %>Constructor<% if (visibleConstructors) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
                }
                if (visibleMethods) { %><li><a href="#method_detail"><% } %>Method<% if (visibleMethods) { %></a></li><% } %>&nbsp;&nbsp;&nbsp;<%
            }
            %>
        </ul>
    </div>
    <% if (props.footer) { %><p>${props.footer}</p><% } %>
    <a name="skip-navbar_bottom">
        <!--   -->
    </a>
    </div>
</div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
