Home | History | Annotate | Download | only in jdiff
      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, mdoar (at) pobox.com
     11  */
     12 class DiffOutput implements Comparable {
     13 
     14     /** The package name for this difference. */
     15     public String pkgName_ = null;
     16 
     17     /** The class name for this difference, may be null. */
     18     public String className_ = null;
     19 
     20     /** The HTML named anchor identifier for this difference. */
     21     public String id_ = null;
     22 
     23     /** The title for this difference. */
     24     public String title_ = null;
     25 
     26     /** The text for this difference, with deleted and added words marked. */
     27     public String text_ = null;
     28 
     29     /** Constructor. */
     30     public DiffOutput(String pkgName, String className, String id,
     31                       String title, String 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 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