KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jdiff > PackageAPI


1 package jdiff;
2
3 import java.io.*;
4 import java.util.*;
5
6 /**
7  * Class to represent a package, analogous to PackageDoc in the
8  * Javadoc doclet API.
9  *
10  * The method used for Collection comparison (compareTo) must make its
11  * comparison based upon everything that is known about this package.
12  *
13  * See the file LICENSE.txt for copyright details.
14  * @author Matthew Doar, doar@pobox.com
15  */

16 class PackageAPI implements Comparable JavaDoc {
17
18     /** Full qualified name of the package. */
19     public String JavaDoc name_;
20
21     /** Classes within this package. */
22     public List classes_; // ClassAPI[]
23

24     /** The doc block, default is null. */
25     public String JavaDoc doc_ = null;
26
27     /** Constructor. */
28     public PackageAPI(String JavaDoc name) {
29         name_ = name;
30         classes_ = new ArrayList(); // ClassAPI[]
31
}
32
33     /** Compare two PackageAPI objects by name. */
34     public int compareTo(Object JavaDoc o) {
35         PackageAPI oPackageAPI = (PackageAPI)o;
36         if (APIComparator.docChanged(doc_, oPackageAPI.doc_))
37             return -1;
38         return name_.compareTo(oPackageAPI.name_);
39     }
40
41     /**
42      * Tests two packages, using just the package name, used by indexOf().
43      */

44     public boolean equals(Object JavaDoc o) {
45         if (name_.compareTo(((PackageAPI)o).name_) == 0)
46             return true;
47         return false;
48     }
49 }
50
Popular Tags