mjc

org.multijava.mjdoc.mjdoc_142
Class MjPackageDoc

java.lang.Object
  extended byorg.multijava.mjdoc.mjdoc_142.MjDoc
      extended byorg.multijava.mjdoc.mjdoc_142.MjPackageDoc
All Implemented Interfaces:
Comparable, com.sun.javadoc.Doc, com.sun.javadoc.PackageDoc

public class MjPackageDoc
extends MjDoc
implements com.sun.javadoc.PackageDoc

This class represents a java package and provides methods for finding a package object and the classes within a package.

Author:
David R. Cok

Field Summary
private static com.sun.javadoc.ClassDoc[] carray
          A helper object to avoid having to create this all the time.
private  Map classes
          A map of the classes registered as in this package (String -> ClassDoc), where the String is the name of the class (with enclosing classes, '.'
private  ArrayList classesInOrder
          This is a list of the classes in the package in the order in which they have been added.
private  ArrayList errorClasses
          Holder for all error classes registered as part of this package.
private  ArrayList exceptionClasses
          Holder for all exception classes registered as part of this package.
private  ArrayList extMethods
          A collection of the compilation units containing external methods in this package.
private  ArrayList interfaces
          Holder for all interfaces registered as part of this package.
private  String location
          The location in the file system of the package root.
private  ArrayList ordinaryClasses
          Holder for all ordinary classes registered as part of this package.
private  String packageName
          Holder for the String name of the package ('.' separated).
private static Map packages
          A map of all the packages created (String -> MjPackageDoc), where the String is the name ('/' separated and terminated) of the package.
 
Fields inherited from class org.multijava.mjdoc.mjdoc_142.MjDoc
parser
 
Constructor Summary
private MjPackageDoc(String n)
          Creates a new MjPackageDoc object from its '/' separated and terminated name; you should ordinarily use createPackage(java.lang.String) so that distinct MjPackageDoc objects refer to distinct packages and all the classes for one package are registered in one MjPackageDoc object.
 
Method Summary
 void addErrorClass(com.sun.javadoc.ClassDoc d)
          Registers an MjClassDoc object as an error class.
 void addExceptionClass(com.sun.javadoc.ClassDoc d)
          Registers an MjClassDoc object as an exception class.
 void addExtMethodsUnit(MjExtMethodsDoc m)
          Adds a Doc representing the external methods in a compilation unit.
 void addInterface(com.sun.javadoc.ClassDoc d)
          Registers an MjClassDoc object as an interface class.
 void addOrdinaryClass(com.sun.javadoc.ClassDoc d)
          Registers an MjClassDoc object as an ordinary (not error, exception, or interface) class.
 com.sun.javadoc.ClassDoc[] allClasses()
          Returns an array of all the classes and interfaces registered with this package.
 com.sun.javadoc.ClassDoc[] allClasses(boolean filter)
          Returns an array of all the classes and interfaces registered with this package.
protected  String compareString()
          This generates the String representation used by compareTo.
 com.sun.javadoc.PackageDoc containingPackage()
          Required but unused method.
static MjPackageDoc createPackage(String s)
          Returns the MjPackageDoc object for the given '/'-separated and terminated name, creating a new one if none currently exists.
 com.sun.javadoc.ClassDoc[] errors()
          Returns an array of the error classes registered with this package.
 com.sun.javadoc.ClassDoc[] exceptions()
          Returns an array of the exception classes registered with this package.
 ArrayList extMethodsUnits()
          Returns a collection of MjExtMethodsDoc objects for this package.
 com.sun.javadoc.ClassDoc findClass(String s)
          Returns the class or interface in this package given the class name ('.'
static MjPackageDoc findPackage(String p)
          Finds an MjPackageDoc from its '/'-separated and terminated name, or returns null if none has yet been created.
 com.sun.javadoc.ClassDoc[] interfaces()
          Returns an array of the interfaces registered with this package.
 String location()
          Returns the location of the root of the package.
 MjExtMethodsDoc lookup(JCompilationUnitType unit)
          Finds the MjExtMethodsDoc object corresponding to the given compilation unit (or creates one if none exists).
 String name()
          Returns the '.'
 com.sun.javadoc.ClassDoc[] ordinaryClasses()
          Returns an array of the ordinary classes registered with this package.
 String prefix()
          Returns the prefix to be appended on the front of a type name to make a fully-qualified name.
 String toString()
          Returns the '.'
 
Methods inherited from class org.multijava.mjdoc.mjdoc_142.MjDoc
commentText, compareTo, firstSentenceTags, getRawCommentText, inlineTags, isClass, isConstructor, isError, isException, isField, isIncluded, isInterface, isMethod, isOrdinaryClass, notImplemented, position, seeTags, setIncluded, setRawCommentText, setRawCommentText, setRawCommentText, setRawCommentText, tags, tags, tags
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sun.javadoc.Doc
commentText, compareTo, firstSentenceTags, getRawCommentText, inlineTags, isClass, isConstructor, isError, isException, isField, isIncluded, isInterface, isMethod, isOrdinaryClass, position, seeTags, setRawCommentText, tags, tags
 

Field Detail

packageName

private String packageName
Holder for the String name of the package ('.' separated).


location

private String location
The location in the file system of the package root.


classes

private Map classes
A map of the classes registered as in this package (String -> ClassDoc), where the String is the name of the class (with enclosing classes, '.'-separated, but not the package name).


classesInOrder

private ArrayList classesInOrder
This is a list of the classes in the package in the order in which they have been added.


extMethods

private ArrayList extMethods
A collection of the compilation units containing external methods in this package.


packages

private static Map packages
A map of all the packages created (String -> MjPackageDoc), where the String is the name ('/' separated and terminated) of the package.


carray

private static final com.sun.javadoc.ClassDoc[] carray
A helper object to avoid having to create this all the time.


ordinaryClasses

private ArrayList ordinaryClasses
Holder for all ordinary classes registered as part of this package.


errorClasses

private ArrayList errorClasses
Holder for all error classes registered as part of this package.


exceptionClasses

private ArrayList exceptionClasses
Holder for all exception classes registered as part of this package.


interfaces

private ArrayList interfaces
Holder for all interfaces registered as part of this package.

Constructor Detail

MjPackageDoc

private MjPackageDoc(String n)
Creates a new MjPackageDoc object from its '/' separated and terminated name; you should ordinarily use createPackage(java.lang.String) so that distinct MjPackageDoc objects refer to distinct packages and all the classes for one package are registered in one MjPackageDoc object. This constructor automatically registers the new MjPackageDoc object in the internal map of such objects.

Method Detail

location

public String location()
Returns the location of the root of the package.


findPackage

public static MjPackageDoc findPackage(String p)
Finds an MjPackageDoc from its '/'-separated and terminated name, or returns null if none has yet been created.


createPackage

public static MjPackageDoc createPackage(String s)
Returns the MjPackageDoc object for the given '/'-separated and terminated name, creating a new one if none currently exists.


name

public String name()
Returns the '.'-separated name of the package (with no terminating '.').

Specified by:
name in interface com.sun.javadoc.Doc

prefix

public String prefix()
Returns the prefix to be appended on the front of a type name to make a fully-qualified name.


addOrdinaryClass

public void addOrdinaryClass(com.sun.javadoc.ClassDoc d)
Registers an MjClassDoc object as an ordinary (not error, exception, or interface) class.


addErrorClass

public void addErrorClass(com.sun.javadoc.ClassDoc d)
Registers an MjClassDoc object as an error class.


addExceptionClass

public void addExceptionClass(com.sun.javadoc.ClassDoc d)
Registers an MjClassDoc object as an exception class.


addInterface

public void addInterface(com.sun.javadoc.ClassDoc d)
Registers an MjClassDoc object as an interface class.


addExtMethodsUnit

public void addExtMethodsUnit(MjExtMethodsDoc m)
Adds a Doc representing the external methods in a compilation unit.


extMethodsUnits

public ArrayList extMethodsUnits()
Returns a collection of MjExtMethodsDoc objects for this package.


lookup

public MjExtMethodsDoc lookup(JCompilationUnitType unit)
Finds the MjExtMethodsDoc object corresponding to the given compilation unit (or creates one if none exists).


containingPackage

public com.sun.javadoc.PackageDoc containingPackage()
Required but unused method.


ordinaryClasses

public com.sun.javadoc.ClassDoc[] ordinaryClasses()
Returns an array of the ordinary classes registered with this package.

Specified by:
ordinaryClasses in interface com.sun.javadoc.PackageDoc

errors

public com.sun.javadoc.ClassDoc[] errors()
Returns an array of the error classes registered with this package.

Specified by:
errors in interface com.sun.javadoc.PackageDoc

exceptions

public com.sun.javadoc.ClassDoc[] exceptions()
Returns an array of the exception classes registered with this package.

Specified by:
exceptions in interface com.sun.javadoc.PackageDoc

interfaces

public com.sun.javadoc.ClassDoc[] interfaces()
Returns an array of the interfaces registered with this package.

Specified by:
interfaces in interface com.sun.javadoc.PackageDoc

allClasses

public com.sun.javadoc.ClassDoc[] allClasses()
Returns an array of all the classes and interfaces registered with this package.

Specified by:
allClasses in interface com.sun.javadoc.PackageDoc

allClasses

public com.sun.javadoc.ClassDoc[] allClasses(boolean filter)
Returns an array of all the classes and interfaces registered with this package. Added for JDK 1.4 compatability. (Note from Gary: I'm not sure from the JDK documentation what the following is supposed to mean...)

Specified by:
allClasses in interface com.sun.javadoc.PackageDoc
Returns:
all classes and interfaces in this package, filtered to include only the included classes if filter==true.

findClass

public com.sun.javadoc.ClassDoc findClass(String s)
Returns the class or interface in this package given the class name ('.'-separated, including any enclosing classes, but not the package name).

Specified by:
findClass in interface com.sun.javadoc.PackageDoc

toString

public String toString()
Returns the '.'-separated name of the package.

Overrides:
toString in class Object

compareString

protected String compareString()
This generates the String representation used by compareTo. We use a different method than toString, because toString is not unique in all cases (e.g. methods with the same identifier but different arguments).

Overrides:
compareString in class MjDoc

mjc

mjc is Copyright (C) 2000-2004 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. mjc is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.