<!--

     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">
<%
def subtitle = 'Deprecated API'
def title = subtitle + (props.windowTitle ? " (${props.windowTitle})" : "")
// TODO enable errors(), enums() etc in SimpleGroovyPackageDoc then replace closures below
def isVisible = { it.isPublic() || (it.isProtected() && props.protectedScope == 'true') || (!it.isProtected() && !it.isPrivate() && props.packageScope == 'true') || props.privateScope == 'true' }

def classTypes = [
    "Interface" : { it.isInterface() && it.isDeprecated() },
    "Trait" : { it.isTrait() && it.isDeprecated() },
    "Class" : { it.isClass() && !it.parentClasses*.qualifiedTypeName().contains('java.lang.Throwable') && it.isDeprecated() },
    "Enum" : { it.isEnum() && it.isDeprecated() },
    "Exception" : { it.isClass() && it.parentClasses*.qualifiedTypeName().contains('java.lang.Exception') && it.isDeprecated() },
    "Error" : { it.isClass() && it.parentClasses*.qualifiedTypeName().contains('java.lang.Error') && it.isDeprecated() },
    "Annotation Type" : { it.isAnnotationType() && it.isDeprecated() }
]
def deprecations = [:]
classTypes.each{ k, v ->
    deprecations[k] = rootDoc.classes().any{ isVisible(it) && v(it) }
}

def methodTypes = [
    "Method" : { it.methods().findAll{ it.isDeprecated() } },
    "Constructor" : { it.constructors().findAll{ it.isDeprecated() } },
]
methodTypes.each{ k, v ->
    deprecations[k] = rootDoc.classes().any{ isVisible(it) && v(it) }
}

def fieldTypes = [
    "Field" : { it.fields().findAll{ it.isDeprecated() } },
    "Property" : { it.properties().findAll{ it.isDeprecated() } },
    "Enum Constant" : { it.enumConstants().findAll{ it.isDeprecated() } },
]
fieldTypes.each{ k, v ->
    deprecations[k] = rootDoc.classes().any{ isVisible(it) && v(it) }
}

def pluralize = { name ->
    name.endsWith('y')?name.substring(0, name.length()-1)+'ies':(name + (name.endsWith("s") ? "es" : "s"))
}

def dolink = { t, classDoc, boolean b ->
    if (!t || t instanceof String) {
        return classDoc.getDocUrl(t, b)
    }
    if (t instanceof org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDoc) {
        return "<a href='" + classDoc.relativeRootPath + t.fullPathName + ".html'>" + (b ? t.qualifiedTypeName() : t.name()) + "</a>"
    }
    return classDoc.getDocUrl(t.qualifiedTypeName(), b)
}
def linkable = { t, classDoc -> dolink(t, classDoc, false) }
def modifiersBrief = { t ->
    (t.isPrivate()?"private&nbsp;":"") +
    (t.isProtected()?"protected&nbsp;":"") +
    (t.isStatic()?"static&nbsp;":"")
}
def paramsOf = { n, classDoc, boolean brief -> n.parameters().collect{ param -> (brief?'':annotations(param, ' ')) + linkable(param.isTypeAvailable()?param.type():param.typeName(), classDoc) + ' ' + param.name() + (param.defaultValue() ? " = " + param.defaultValue():"") }.join(", ") }
def nameFromParams = { n -> n.name() + '(' + n.parameters().collect{ param -> param.isTypeAvailable()?param.type().qualifiedTypeName():param.typeName() }.join(', ') + ')' }
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=${props.charset}">
    <!-- 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 Date().format('yyyy-MM-dd')}"><% } %>
    <link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
    <link href="groovy.ico" type="image/x-icon" rel="shortcut icon">
    <link href="groovy.ico" type="image/x-icon" rel="icon">

</head>
<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="overview-summary.html">Overview</a></li>
        <li>Package</li>
        <li>Class</li>
        <li class="navBarCell1Rev">Deprecated</li>
        <li><a href="index-all.html">Index</a></li>
        <li><a href="help-doc.html">Help</a></li>
    </ul>
</div>
<div class="subNav">
    <ul class="navList">
        <li><a href="index.html?deprecated-list.html" target="_top">Frames</a></li>
        <li><a href="deprecated-list.html" target="_top">No Frames</a></li>
    </ul>
    <a name="skip-navbar_top">
        <!--   -->
    </a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
    <h1 title="Deprecated API" class="title">Deprecated API</h1>
    <h2 title="Contents">Contents</h2>
    <ul>
        <% deprecations.each { k, v -> if (v) { %>
        <li><a href="#${k.toLowerCase()}">Deprecated ${k}</a></li>
        <% } } %>
    </ul>
</div>
<div class="contentContainer">
<%
fieldTypes.each{ k, v ->
    if (deprecations[k]) {
%>
<!-- Deprecated fields/properties/enum constant types -->
    <a name="${k.toLowerCase()}"><!--   --></a><ul class="blockList">
    <li class="blockList">
        <table border="0" cellpadding="3" cellspacing="0" summary="Deprecated ${pluralize(k)} table, listing deprecated ${pluralize(k).toLowerCase()}, and an explanation">
            <caption><span>Deprecated ${pluralize(k)}</span><span class="tabEnd">&nbsp;</span></caption>
            <tr>
                <th class="colOne" scope="col">${k} and Description</th>
            </tr>
            <tbody>
            <%
                rootDoc.classes().findAll{ isVisible(it) && v(it) }.each { classDoc ->
                    v(classDoc).eachWithIndex { field, i ->
                    %><tr class="${i%2==0?'altColor':'rowColor'}">
                <td class="colOne">
                    <strong><a href="${classDoc.fullPathName}.html#${field.name()}">${classDoc.name()}#${field.name()}</a></strong>
                </td>
                <td>
                    <div class="block"><i>${field.firstSentenceCommentText()}</i></div>
                </td>
            </tr>
            <%
                } // eachWithIndex { field, i ->
            } // eachWithIndex.each { classDoc ->
            %>
            </tbody>
        </table>
    </li>
</ul>

<% } // if rootDoc.classes()
} // fieldTypes.each

classTypes.each{ k, v ->
    if (deprecations[k]) {
%>
<!-- Deprecated class/interface/enum types -->
    <a name="${k.toLowerCase()}"><!--   --></a><ul class="blockList">
    <li class="blockList">
        <table border="0" cellpadding="3" cellspacing="0" summary="Deprecated ${pluralize(k)} table, listing deprecated ${pluralize(k).toLowerCase()}, and an explanation">
            <caption><span>Deprecated ${pluralize(k)}</span><span class="tabEnd">&nbsp;</span></caption>
            <tr>
                <th class="colOne" scope="col">${k} and Description</th>
            </tr>
            <tbody>
            <%
                rootDoc.classes().findAll{ isVisible(it) && v(it) }.eachWithIndex { classDoc, i ->
                    def packageOrInnerName = classDoc.qualifiedTypeName() - ('.' + classDoc.simpleTypeName())
                    %><tr class="${i%2==0?'altColor':'rowColor'}">
                <td class="colOne"><a href="${classDoc.fullPathName}.html"><%
                        if (classDoc.isInterface() || classDoc.isTrait()) { %><i><% }
                        %>${classDoc.name()}<%
                        if (classDoc.isInterface() || classDoc.isTrait()) { %></i><% }
                        %></a>
                    <div class="block"><i>${classDoc.firstSentenceCommentText()}</i></div>
                </td>
            </tr>
            <%
                } // eachWithIndex
            %>
            </tbody>
        </table>
    </li>
</ul>

<% } // if rootDoc.classes()
} // classTypes.each

methodTypes.each{ k, v ->
    if (deprecations[k]) {
%>
<a name="${k.toLowerCase()}"><!--   --></a><ul class="blockList">
    <li class="blockList">
        <table border="0" cellpadding="3" cellspacing="0" summary="Deprecated ${pluralize(k)} table, listing deprecated ${pluralize(k).toLowerCase()}, and an explanation">
            <caption><span>Deprecated ${pluralize(k)}</span><span class="tabEnd">&nbsp;</span></caption>
            <tr>
                <th class="colOne" scope="col">${k} and Description</th>
            </tr>
            <tbody>
            <%
                rootDoc.classes().findAll{ isVisible(it) && v(it) }.each { classDoc ->
                    v(classDoc).eachWithIndex { methOrConstr, i ->
                    %><tr class="${i%2==0?'altColor':'rowColor'}">
                <td class="colOne"><strong><a href="${classDoc.fullPathName}.html#${nameFromParams(methOrConstr)}">${classDoc.name()}#${methOrConstr.name()}</a></strong>(${paramsOf(methOrConstr, classDoc, true)})
                    <div class="block"><i>${methOrConstr.firstSentenceCommentText()}</i></div>
                </td>
            </tr>
            <%
                } // eachWithIndex { methOrConstr, i ->
            } // eachWithIndex.each { classDoc ->
            %>
            </tbody>
        </table>
    </li>
</ul>
<% } //  if (rootDoc.classes()
} // methodTypes.each
%>

</div>
<!-- ======= 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="overview-summary.html">Overview</a></li>
        <li>Package</li>
        <li>Class</li>
        <li class="navBarCell1Rev">Deprecated</li>
        <li><a href="index-all.html">Index</a></li>
        <li><a href="help-doc.html">Help</a></li>
    </ul>
</div>
<div class="subNav">
    <ul class="navList">
        <li><a href="index.html?deprecated-list.html" target="_top">Frames</a></li>
        <li><a href="deprecated-list.html" target="_top">No Frames</a></li>
    </ul>
    <div class="aboutLanguage"><em>${props['footer']?:""}</em></div>
    <a name="skip-navbar_bottom">
        <!--   -->
    </a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

</body>
</html>
