tzh
2024-08-20 ca8393c352368485bcb8b277004fdb0c6cb572c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package jdiff;
 
import java.io.*;
import java.util.*;
 
/** 
 * Class to represent a single documentation difference.
 *
 * See the file LICENSE.txt for copyright details.
 * @author Matthew Doar, mdoar@pobox.com
 */
class DiffOutput implements Comparable {
 
    /** The package name for this difference. */
    public String pkgName_ = null;
 
    /** The class name for this difference, may be null. */
    public String className_ = null;
 
    /** The HTML named anchor identifier for this difference. */
    public String id_ = null;
 
    /** The title for this difference. */
    public String title_ = null;
 
    /** The text for this difference, with deleted and added words marked. */
    public String text_ = null;
 
    /** Constructor. */
    public DiffOutput(String pkgName, String className, String id, 
                      String title, String text) {
        pkgName_ = pkgName;
        className_ = className;
        id_ = id;
        title_ = title;
        text_ = text;
    }
 
    /** 
     * Compare two DiffOutput objects, so they will appear in the correct
     * package. 
     */
    public int compareTo(Object o) {
        DiffOutput oDiffOutput = (DiffOutput)o;
        int comp = pkgName_.compareTo(oDiffOutput.pkgName_);
        if (comp != 0)
            return comp;
        // Always put the package-level output at the top - not yet working
//        if (id_.compareTo("package") == 0)
//            return -1;
        return id_.compareTo(oDiffOutput.id_);
    }    
        
}