// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) deadcode 
// Source File Name:   ExecutableMemberDocImpl.java

package com.sun.tools.javadoc;

import com.sun.javadoc.*;
import com.sun.tools.javac.v8.code.Symbol;
import com.sun.tools.javac.v8.code.Type;
import com.sun.tools.javac.v8.tree.Tree;
import com.sun.tools.javac.v8.util.*;
import java.lang.reflect.Modifier;
import java.text.CollationKey;
import java.text.Collator;

// Referenced classes of package com.sun.tools.javadoc:
//            MemberDocImpl, ClassDocImpl, Comment, DocEnv, 
//            DocLocale, ParameterImpl, SourcePositionImpl, TypeMaker

public abstract class ExecutableMemberDocImpl extends MemberDocImpl
    implements ExecutableMemberDoc
{

    protected long getFlags()
    {
        return sym.flags();
    }

    public boolean isIncluded()
    {
        return containingClass().isIncluded() && env.shouldDocument(sym);
    }

    public boolean isNative()
    {
        return Modifier.isNative(getModifiers());
    }

    public boolean isSynchronized()
    {
        return Modifier.isSynchronized(getModifiers());
    }

    public boolean isSynthetic()
    {
        return (sym.flags() & 0x10000L) != 0L;
    }

    public ClassDoc[] thrownExceptions()
    {
        ListBuffer listbuffer = new ListBuffer();
        for(List list = sym.type.thrown(); list.nonEmpty(); list = list.tail)
        {
            ClassDocImpl classdocimpl = env.getClassDoc((com.sun.tools.javac.v8.code.Symbol.ClassSymbol)((Type)list.head).tsym);
            if(classdocimpl != null)
                listbuffer.append(classdocimpl);
        }

        return (ClassDoc[])listbuffer.toArray(new ClassDocImpl[listbuffer.length()]);
    }

    public ParamTag[] paramTags()
    {
        return comment().paramTags();
    }

    public Parameter[] parameters()
    {
        ListBuffer listbuffer = new ListBuffer();
        List list = argNames;
        if(list.nonEmpty())
        {
            for(List list1 = sym.type.argtypes(); list1.nonEmpty(); list1 = list1.tail)
            {
                String s = ((Name)list.head).toString();
                listbuffer.append(new ParameterImpl(env, (Type)list1.head, s));
                list = list.tail;
            }

        } else
        {
            for(List list2 = sym.type.argtypes(); list2.nonEmpty(); list2 = list2.tail)
                listbuffer.append(new ParameterImpl(env, (Type)list2.head, ""));

        }
        return (Parameter[])listbuffer.toArray(new Parameter[listbuffer.length()]);
    }

    public SourcePosition position()
    {
        if(sym.enclClass().sourcefile == null)
            return null;
        else
            return SourcePositionImpl.make(sym.enclClass().sourcefile.toString(), tree != null ? tree.pos : 0);
    }

    public ThrowsTag[] throwsTags()
    {
        return comment().throwsTags();
    }

    protected com.sun.tools.javac.v8.code.Symbol.ClassSymbol getContainingClass()
    {
        return sym.enclClass();
    }

    void setArgNames(List list)
    {
        argNames = list;
    }

    public String flatSignature()
    {
        return makeSignature(false);
    }

    public String signature()
    {
        return makeSignature(true);
    }

    public String toQualifiedString()
    {
        return qualifiedName() + flatSignature();
    }

    public String toString()
    {
        return qualifiedName() + signature();
    }

    private String makeSignature(boolean flag)
    {
        StringBuffer stringbuffer = new StringBuffer();
        stringbuffer.append("(");
        List list = sym.type.argtypes();
        do
        {
            if(!list.nonEmpty())
                break;
            Type type = (Type)list.head;
            stringbuffer.append(TypeMaker.getTypeName(type, flag));
            list = list.tail;
            if(list.nonEmpty())
                stringbuffer.append(", ");
        } while(true);
        stringbuffer.append(")");
        return stringbuffer.toString();
    }

    CollationKey generateKey()
    {
        String s = flatSignature();
        if(s.indexOf(",") > 0)
            s = s.replace(',', ' ');
        String s1 = name() + s;
        return env.doclocale.collator.getCollationKey(s1);
    }

    public ExecutableMemberDocImpl(DocEnv docenv, com.sun.tools.javac.v8.code.Symbol.MethodSymbol methodsymbol)
    {
        ExecutableMemberDocImpl(docenv, methodsymbol, null, new List());
    }

    public ExecutableMemberDocImpl(DocEnv docenv, com.sun.tools.javac.v8.code.Symbol.MethodSymbol methodsymbol, String s, List list)
    {
        MemberDocImpl(docenv, s);
        tree = null;
        sym = methodsymbol;
        argNames = list;
    }

    protected final com.sun.tools.javac.v8.code.Symbol.MethodSymbol sym;
    private List argNames;
    com.sun.tools.javac.v8.tree.Tree.MethodDef tree;
}
