KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jdiff > DiffOutput


1 package jdiff;
2
3 import java.io.*;
4 import java.util.*;
5
6 /**
7  * Class to represent a single documentation difference.
8  *
9  * See the file LICENSE.txt for copyright details.
10  * @author Matthew Doar, doar@pobox.com
11  */

12 class DiffOutput implements Comparable JavaDoc {
13
14     /** The package name for this difference. */
15     public String JavaDoc pkgName_ = null;
16
17     /** The class name for this difference, may be null. */
18     public String JavaDoc className_ = null;
19
20     /** The HTML named anchor identifier for this difference. */
21     public String JavaDoc id_ = null;
22
23     /** The title for this difference. */
24     public String JavaDoc title_ = null;
25
26     /** The text for this difference, with deleted and added words marked. */
27     public String JavaDoc text_ = null;
28
29     /** Constructor. */
30     public DiffOutput(String JavaDoc pkgName, String JavaDoc className, String JavaDoc id,
31                       String JavaDoc title, String JavaDoc text) {
32         pkgName_ = pkgName;
33         className_ = className;
34         id_ = id;
35         title_ = title;
36         text_ = text;
37     }
38
39     /**
40      * Compare two DiffOutput objects, so they will appear in the correct
41      * package.
42      */

43     public int compareTo(Object JavaDoc o) {
44         DiffOutput oDiffOutput = (DiffOutput)o;
45         int comp = pkgName_.compareTo(oDiffOutput.pkgName_);
46         if (comp != 0)
47             return comp;
48         // Always put the package-level output at the top - not yet working
49
// if (id_.compareTo("package") == 0)
50
// return -1;
51
return id_.compareTo(oDiffOutput.id_);
52     }
53         
54 }
55
Popular Tags