com.guiffy.inside
Class GuiffyReport

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--com.guiffy.inside.GuiffyReport

public class GuiffyReport
extends java.lang.Thread

/* Class GuiffyReport is the compare report engine for generating Guiffy compare reports within Java applications. GuiffyReport extends Thread.

Guiffy compares source(text) files of any type - supports Unicode character set. And, Guiffy accepts all 3 forms of end-of-line.

Example code :
The following instantiates a GuiffyReport object with all its properties set to default.

import com.guiffy.inside.*;
      ...
      GuiffyReport gRep = new GuiffyReport( );
Then, we set GuiffyReport compare file names and the report file name.
      gRep.set1stFile(firFileName);
      gRep.set2ndFile(secFileName);
      gRep.setRepFile(repFileName);
Then, we run GuiffyReport.
      gRep.start();
And, wait for GuiffyReport Thread to finish
      try {
          gRep.join();
      } catch (InterruptedException e) { System.err.println ( e.toString() ); }
Then, we check the return status.
      int rstat = gRep.getStatus();

      if (rstat != GuiffyReport.OK) {
          System.err.println( "GuiffyReport error: status=" + rstat);
          System.exit(rstat);
      }
OR you can use the Exit Hook technique:
      GuiffyHook grhook = new GuiffyHook();
      grhook.setGuiffyReport(gRep);
      gRep.setGuiffyExit(grhook);
      gRep.start();
Then, (in the exitHook) we check the return status.
      if(ghgr != null) {
        int rstat = ghgr.getStatus();

        if (rstat != GuiffyReport.OK) {
            System.err.println( "GuiffyReport error: status=" + rstat);
            System.exit(rstat);
        }
And, if the Report ran, we get the Report metrics.
        System.err.println("Changes=" + ghgr.getNumberofChanges() );
        System.err.println("Matching=" + ghgr.getNumberofLinesMatching() );
        System.err.println("Deleted=" + ghgr.getNumberofLinesDeleted() );
        System.err.println("Inserted=" + ghgr.getNumberofLinesInserted() );
      } 

Version:
7.2 -- developed in December, 2005.
Author:
Guiffy Software, Inc. by Bill Ritcher
See Also:
Thread

Field Summary
static int CANT_FIND_1STFILE
           
static int CANT_FIND_2NDFILE
           
static int CANT_READ_1STFILE
           
static int CANT_READ_2NDFILE
           
static int CANT_WRIT_RESFILE
           
static int ENCODING_NOTAVAIL
           
static int ERRORIS_EXCEPTION
           
static int EVALPER_ISEXPIRED
           
static int ISAFOLDER_1STFILE
           
static int ISAFOLDER_2NDFILE
           
static int OK
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GuiffyReport()
           
 
Method Summary
 int getNumberofChanges()
          Returns the number of change blocks.
 int getNumberofLinesDeleted()
          Returns the number of lines deleted.
 int getNumberofLinesInserted()
          Returns the number of lines inserted.
 int getNumberofLinesMatching()
          Returns the number of lines matching.
 int getStatus()
          Returns Status of GuiffyReport Run.
 void run()
           
 void set1stFile(java.lang.String firstname)
          Sets the 1st File Name.
 void set1stFileEncoding(java.lang.String encods)
          Sets File Encoding for 1st files.
 void set1stHTMLTableWriter(java.io.Writer htmlwrer)
          Sets the 1stTableHTML Writer.
 void set1stReader(java.io.Reader firstrder)
          Sets the 1st Reader.
 void set2ndFile(java.lang.String secndname)
          Sets the 2nd File Name.
 void set2ndFileEncoding(java.lang.String encods)
          Sets File Encoding for 2nd files.
 void set2ndHTMLTableWriter(java.io.Writer htmlwrer)
          Sets the 2ndTableHTML Writer.
 void set2ndReader(java.io.Reader secndrder)
          Sets the 2nd Reader.
 void setBackgroundColor(java.awt.Color baccol)
          Sets the Background color option(Matching, Inserted, and Deleted).
 void setChangedBackgroundColor(java.awt.Color chnbac)
          Sets the Changed background color option.
 void setDeletesBackgroundColor(java.awt.Color delbac)
          Sets the Deleted background color option.
 void setDeletesColor(java.awt.Color delcol)
          Sets the Deleted text foreground color option.
 void setDeletesFont(java.awt.Font delfon)
          Sets the Deleted text font option.
 void setEOLOption(java.lang.String eolopt)
          Sets Write EOLs option for Saved files.
 void setEscapeTags(boolean esctag)
          Sets Escape Tags option (for compare htlm reports) true or false.
 void setFileEncoding(java.lang.String encods)
          Sets File Encoding for 1st and 2nd files.
 void setFillerBackgroundColor(java.awt.Color filbac)
          Sets the Filler background color option.
 void setFillerColor(java.awt.Color filcol)
          Sets the Filler foreground color option.
 void setFillerFont(java.awt.Font filfon)
          Sets the Fillers font option.
 void setGuiffyExit(GuiffyExit hook)
          Sets the GuiffyExit hook of the GuiffyReport If set to null, a previously added GuiffyExit hook will be removed.
 void setH1(java.lang.String header)
          Sets the 1st FileName header.
 void setH2(java.lang.String header)
          Sets the 2nd FileName header.
 void setIgnoreBlank(boolean ignblk)
          Sets IgnoreBlanklines option true or false.
 void setIgnoreCase(boolean igncas)
          Sets IgnoreCase option true or false.
 void setIgnoreEmbeddedWhiteSpace(boolean igs)
          Sets Ignore Embedded type Whitespace flag.
 void setIgnoreField(int begcol, int endcol)
          Sets IgnoreField option columns xxx thru yyy.
 void setIgnoreField2(int begcol, int endcol)
          Sets IgnoreField2 option columns xxx thru yyy.
 void setIgnoreLeadingWhiteSpace(boolean igs)
          Sets Ignore Leading type Whitespace flag.
 void setIgnoreTrailingWhiteSpace(boolean igs)
          Sets Ignore Trailing type Whitespace flag.
 void setIgnoreWhitespace(boolean ignwhi)
          Sets IgnoreWhitespace of all types option true or false.
 void setInsertsBackgroundColor(java.awt.Color insbac)
          Sets the Inserted background color option.
 void setInsertsColor(java.awt.Color inscol)
          Sets the Inserted text foreground color option.
 void setInsertsFont(java.awt.Font insfon)
          Sets the Inserted text font option.
 void setLineNumBackgroundColor(java.awt.Color linbac)
          Sets the LineNumbers background color option.
 void setLineNumColor(java.awt.Color lincol)
          Sets the LineNumbers foreground color option.
 void setLineNumFont(java.awt.Font linfon)
          Sets the LineNumbers font option.
 void setMatchingBackgroundColor(java.awt.Color matbac)
          Sets the Matching background color option.
 void setMatchingColor(java.awt.Color matcol)
          Sets the Matching text foreground color option.
 void setMatchingFont(java.awt.Font matfon)
          Sets the Matching text font option.
 void setMinimumBlocksDiff(boolean minblk)
          Sets Minimize Blocks Changed Diff option true or false.
 void setOEMLicenseKey(java.io.ByteArrayInputStream bais)
          Set License Key based on special OEMKey ByteArrayInputStream
 void setQtRexs(java.lang.String[] rxs, int rxi)
          Sets Quietly Ignore Regular Expressions list.
 void setRepFile(java.lang.String htmlrname)
          Sets the HTML Report File Name.
 void setRepWriter(java.io.Writer htmlwrer)
          Sets the HTML Report Writer.
 void setSaveEncoding(java.lang.String encods)
          Sets Save Encoding for MergeResult file.
 void setShowContextDiffs(boolean shocxt)
          Sets Show Context Differences option true or false.
 void setShowContextKB(int conkbs)
          Sets Show Context When KB Size option.
 void setShowContextSize(int conlns)
          Sets Show Context Differences Size option.
 void setShowContextWhen(boolean shocxt)
          Sets Show Context When option true or false.
 void setShowGutter(boolean shogut)
          Sets Show Gutter option (for compare htlm reports) true or false.
 void setShowIgnoredDiffs(boolean sig)
          Sets Show Ignored Diffs default is false.
 void setShowInLineDiffs(boolean shoinl)
          Sets Show InLine Differences option true or false.
 void setShowInLinePercent(int shopct)
          Sets Show InLine Differences < Percent of line value.
 void setShowLineNumbers(boolean sholno)
          Sets Show Line Numbers option true or false.
 void setShowOnlyDiffs(boolean shonly)
          Sets Show Only Differences option true or false.
 void setTabSize(int tabsiz)
          Sets Tab Size option.
 void setViewSplitVertical(boolean viwver)
          Sets View Split Vertical option true or false.
 void setViewTogether(boolean viwtog)
          Sets View Together option true or false.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OK

public static final int OK

CANT_FIND_1STFILE

public static final int CANT_FIND_1STFILE

CANT_FIND_2NDFILE

public static final int CANT_FIND_2NDFILE

CANT_READ_1STFILE

public static final int CANT_READ_1STFILE

CANT_READ_2NDFILE

public static final int CANT_READ_2NDFILE

CANT_WRIT_RESFILE

public static final int CANT_WRIT_RESFILE

ISAFOLDER_1STFILE

public static final int ISAFOLDER_1STFILE

ISAFOLDER_2NDFILE

public static final int ISAFOLDER_2NDFILE

ENCODING_NOTAVAIL

public static final int ENCODING_NOTAVAIL

ERRORIS_EXCEPTION

public static final int ERRORIS_EXCEPTION

EVALPER_ISEXPIRED

public static final int EVALPER_ISEXPIRED
Constructor Detail

GuiffyReport

public GuiffyReport()
Method Detail

run

public void run()
Overrides:
run in class java.lang.Thread

getStatus

public int getStatus()
Returns Status of GuiffyReport Run.
Returns:
the int value that indicates the status of run:
   OK = 0;
   CANT_FIND_1STFILE = 1;  // Can't find 1st file
   CANT_FIND_2NDFILE = 2;  // Can't find 2nd file
   CANT_READ_1STFILE = 4;  // Can't read 1st file
   CANT_READ_2NDFILE = 5;  // Can't read 2nd file
   CANT_WRIT_RESFILE = 7;  // Can't write/create Result file
   ENCODING_NOTAVAIL = 11; // File Encoding specified NA
   ERRORIS_EXCEPTION = 12; // Exception
                           // (perhaps, encoding format)
   EVALPER_ISEXPIRED = 13; // Evaluation period has expired

getNumberofChanges

public int getNumberofChanges()
Returns the number of change blocks.
Returns:
the integer value - the number of change blocks of the previous compare operation.

getNumberofLinesMatching

public int getNumberofLinesMatching()
Returns the number of lines matching.
Returns:
the integer value - the number of lines matching in the previous compare operation.

getNumberofLinesDeleted

public int getNumberofLinesDeleted()
Returns the number of lines deleted.
Returns:
the integer value - the number of lines deleted in the previous compare operation.

getNumberofLinesInserted

public int getNumberofLinesInserted()
Returns the number of lines inserted.
Returns:
the integer value - the number of lines inserted in the previous compare operation.

setGuiffyExit

public void setGuiffyExit(GuiffyExit hook)
Sets the GuiffyExit hook of the GuiffyReport If set to null, a previously added GuiffyExit hook will be removed.
See Also:
GuiffyExit

setOEMLicenseKey

public void setOEMLicenseKey(java.io.ByteArrayInputStream bais)
Set License Key based on special OEMKey ByteArrayInputStream

set1stFile

public void set1stFile(java.lang.String firstname)
Sets the 1st File Name.
Parameters:
firstname - the 1st File name as a complete path.

set2ndFile

public void set2ndFile(java.lang.String secndname)
Sets the 2nd File Name.
Parameters:
secndname - the 2nd File name as a complete path.

set1stReader

public void set1stReader(java.io.Reader firstrder)
Sets the 1st Reader.
Parameters:
firstrder - the 1st Reader.

set2ndReader

public void set2ndReader(java.io.Reader secndrder)
Sets the 2nd Reader.
Parameters:
secndrder - the 2nd Reader.

setRepFile

public void setRepFile(java.lang.String htmlrname)
Sets the HTML Report File Name.
Parameters:
htmlrname - the HTML Report File name as a complete path.

setRepWriter

public void setRepWriter(java.io.Writer htmlwrer)
Sets the HTML Report Writer.
Parameters:
htmlwrer - the Result Writer.

set1stHTMLTableWriter

public void set1stHTMLTableWriter(java.io.Writer htmlwrer)
Sets the 1stTableHTML Writer.
Parameters:
htmlwrer - the Result Writer.

set2ndHTMLTableWriter

public void set2ndHTMLTableWriter(java.io.Writer htmlwrer)
Sets the 2ndTableHTML Writer.
Parameters:
htmlwrer - the Result Writer.

setH1

public void setH1(java.lang.String header)
Sets the 1st FileName header.
Parameters:
header - the 1st filename header.

setH2

public void setH2(java.lang.String header)
Sets the 2nd FileName header.
Parameters:
header - the 2nd filename header.

setFileEncoding

public void setFileEncoding(java.lang.String encods)
Sets File Encoding for 1st and 2nd files. Default is the format of the Locale operating environment.
Parameters:
encods - the String value of the Encoding such as "ASCII", "UTF8", "SJIS", "Cp500" (for EBCDIC) etc. - Over 100 formats supported.

set1stFileEncoding

public void set1stFileEncoding(java.lang.String encods)
Sets File Encoding for 1st files. Default is the format of the Locale operating environment.
Parameters:
encods - the String value of the Encoding such as "ASCII", "UTF8", "SJIS", "Cp500" (for EBCDIC) etc. - Over 100 formats supported.

set2ndFileEncoding

public void set2ndFileEncoding(java.lang.String encods)
Sets File Encoding for 2nd files. Default is the format of the Locale operating environment.
Parameters:
encods - the String value of the Encoding such as "ASCII", "UTF8", "SJIS", "Cp500" (for EBCDIC) etc. - Over 100 formats supported.

setSaveEncoding

public void setSaveEncoding(java.lang.String encods)
Sets Save Encoding for MergeResult file. Default is the format of the Locale operating environment.
Parameters:
encods - the String value of the Encoding such as "ASCII", "UTF8", "SJIS", "Cp500" (for EBCDIC) etc. - Over 100 formats supported.

setIgnoreCase

public void setIgnoreCase(boolean igncas)
Sets IgnoreCase option true or false. Default is false.
Parameters:
igncas - the boolean value that determines whether case differences are ignored during the compare.

setIgnoreField

public void setIgnoreField(int begcol,
                           int endcol)
Sets IgnoreField option columns xxx thru yyy. Default is none(0 thru 0).
Parameters:
begcol - the ignore field's beginning column
endcol - the ignore field's ending column Tabs are expanded according to the TabSize value prior to ignoring a field

setIgnoreField2

public void setIgnoreField2(int begcol,
                            int endcol)
Sets IgnoreField2 option columns xxx thru yyy. Default is none(0 thru 0).
Parameters:
begcol - the ignore field's beginning column
endcol - the ignore field's ending column Tabs are expanded according to the TabSize value prior to ignoring a field

setIgnoreWhitespace

public void setIgnoreWhitespace(boolean ignwhi)
Sets IgnoreWhitespace of all types option true or false. Default is false.
Parameters:
ignwhi - the boolean value that determines whether whitespace differences are ignored during the compare.

setIgnoreLeadingWhiteSpace

public void setIgnoreLeadingWhiteSpace(boolean igs)
Sets Ignore Leading type Whitespace flag. Default is false.
Parameters:
igs - the boolean value that determines whether leading whitespace differences are ignored during the compare.

setIgnoreEmbeddedWhiteSpace

public void setIgnoreEmbeddedWhiteSpace(boolean igs)
Sets Ignore Embedded type Whitespace flag. Default is false.
Parameters:
igs - the boolean value that determines whether embedded whitespace differences are ignored during the compare.

setIgnoreTrailingWhiteSpace

public void setIgnoreTrailingWhiteSpace(boolean igs)
Sets Ignore Trailing type Whitespace flag. Default is false.
Parameters:
igs - the boolean value that determines whether trailing whitespace differences are ignored during the compare.

setIgnoreBlank

public void setIgnoreBlank(boolean ignblk)
Sets IgnoreBlanklines option true or false. Default is false.
Parameters:
ignblk - the boolean value that determines whether blankline differences are ignored during the compare.

setQtRexs

public void setQtRexs(java.lang.String[] rxs,
                      int rxi)
Sets Quietly Ignore Regular Expressions list.
Parameters:
rxs - the String array of ignore regular expressions.
rxi - the number of regular expressions.

setTabSize

public void setTabSize(int tabsiz)
Sets Tab Size option. Default is 8.
Parameters:
tabsiz - the int value that specifies tab sizes. Tabs are expanded for the Ignore Field.

setEOLOption

public void setEOLOption(java.lang.String eolopt)
Sets Write EOLs option for Saved files. Default is the format of the operating environment.
Parameters:
eolopt - the String value of "DOS", "MacOS" or "Unix" specifies the format for writing End-Of-Lines in Saved Files.

setShowOnlyDiffs

public void setShowOnlyDiffs(boolean shonly)
Sets Show Only Differences option true or false. Default is false.
Parameters:
shonly - the boolean value that specifies to show only the differences in compare views.

setShowContextDiffs

public void setShowContextDiffs(boolean shocxt)
Sets Show Context Differences option true or false. Default is true.
Parameters:
shocxt - the boolean value that specifies to show context around differences in compare views.

setShowContextSize

public void setShowContextSize(int conlns)
Sets Show Context Differences Size option. Default is 10.
Parameters:
conlns - the number of lines of context to show before and after differences. If less than 1, default of 10 is used. If greater than 48, value of 48 is used.

setShowContextWhen

public void setShowContextWhen(boolean shocxt)
Sets Show Context When option true or false. Default is true.
Parameters:
shocxt - the boolean value that specifies to show context when files are > specified KB in size.

setShowContextKB

public void setShowContextKB(int conkbs)
Sets Show Context When KB Size option. Default is 400.
Parameters:
conkbs - show context when file is > KB. If less than 1, default of 400 is used.

setShowInLineDiffs

public void setShowInLineDiffs(boolean shoinl)
Sets Show InLine Differences option true or false. Default is true.
Parameters:
shoinl - the boolean value that specifies to show InLine diffs in compare views.

setShowInLinePercent

public void setShowInLinePercent(int shopct)
Sets Show InLine Differences < Percent of line value. Default is 50.
Parameters:
shopct - the int value that specifies to show InLine diffs when < percent of line length.

setShowIgnoredDiffs

public void setShowIgnoredDiffs(boolean sig)
Sets Show Ignored Diffs default is false.
Parameters:
sig - the boolean value for show ignored diffs

setShowLineNumbers

public void setShowLineNumbers(boolean sholno)
Sets Show Line Numbers option true or false. Default is true.
Parameters:
sholno - the boolean value that specifies to show Line Numbers in compare views.

setShowGutter

public void setShowGutter(boolean shogut)
Sets Show Gutter option (for compare htlm reports) true or false. Default is true.
Parameters:
shogut - the boolean value that specifies to show Gutter in compare report.

setEscapeTags

public void setEscapeTags(boolean esctag)
Sets Escape Tags option (for compare htlm reports) true or false. Default is true.
Parameters:
esctag - the boolean value that specifies to escape tags in compare report.

setMatchingFont

public void setMatchingFont(java.awt.Font matfon)
Sets the Matching text font option. Default is "Courier New" or "Monospaced", Font.PLAIN, 12.
Parameters:
matfon - the Font for Matching text.

setInsertsFont

public void setInsertsFont(java.awt.Font insfon)
Sets the Inserted text font option. Default is "Courier New" or "Monospaced", Font.PLAIN, 12.
Parameters:
insfon - the Font for Inserted text.

setDeletesFont

public void setDeletesFont(java.awt.Font delfon)
Sets the Deleted text font option. Default is "Courier New" or "Monospaced", Font.PLAIN, 12.
Parameters:
delfon - the Font for Deleted text.

setLineNumFont

public void setLineNumFont(java.awt.Font linfon)
Sets the LineNumbers font option. Default is "Courier New" or"Monospaced", Font.PLAIN, 12.
Parameters:
linfon - the Font for LineNumbers.

setFillerFont

public void setFillerFont(java.awt.Font filfon)
Sets the Fillers font option. Default is "Courier New" or"Monospaced", Font.PLAIN, 12.
Parameters:
filfon - the Font for Fillers.

setBackgroundColor

public void setBackgroundColor(java.awt.Color baccol)
Sets the Background color option(Matching, Inserted, and Deleted). Default RGB values are 255, 255, and 255. colors.
Parameters:
baccol - the Color for Backgrounds.

setMatchingColor

public void setMatchingColor(java.awt.Color matcol)
Sets the Matching text foreground color option. Default RGB values are 4, 4, and 2.
Parameters:
matcol - the Color for Matching text foreground.

setMatchingBackgroundColor

public void setMatchingBackgroundColor(java.awt.Color matbac)
Sets the Matching background color option. Default RGB values are 255, 255, and 255.
Parameters:
matbac - the Color for Matching background.

setInsertsColor

public void setInsertsColor(java.awt.Color inscol)
Sets the Inserted text foreground color option. Default RGB values are 0, 112, and 0.
Parameters:
inscol - the Color for Inserted text foreground.

setInsertsBackgroundColor

public void setInsertsBackgroundColor(java.awt.Color insbac)
Sets the Inserted background color option. Default RGB values are 205, 235, and 205.
Parameters:
insbac - the Color for Inserted background.

setDeletesColor

public void setDeletesColor(java.awt.Color delcol)
Sets the Deleted text foreground color option. Default RGB values are 208, 96, and 0.
Parameters:
delcol - the Color for Deleted text foreground.

setDeletesBackgroundColor

public void setDeletesBackgroundColor(java.awt.Color delbac)
Sets the Deleted background color option. Default RGB values are 235, 205, and 205.
Parameters:
delbac - the Color for Deleted background.

setChangedBackgroundColor

public void setChangedBackgroundColor(java.awt.Color chnbac)
Sets the Changed background color option. Default RGB values are 205, 205, and 235.
Parameters:
chnbac - the Color for Changed background.

setLineNumColor

public void setLineNumColor(java.awt.Color lincol)
Sets the LineNumbers foreground color option. Default RGB values are 66, 66, and 66.
Parameters:
lincol - the Color for LineNumbers foreground.

setLineNumBackgroundColor

public void setLineNumBackgroundColor(java.awt.Color linbac)
Sets the LineNumbers background color option. Default RGB values are 211, 212, and 213.
Parameters:
linbac - the Color for LineNumbers background.

setFillerColor

public void setFillerColor(java.awt.Color filcol)
Sets the Filler foreground color option. Default RGB values are 97, 98, and 99.
Parameters:
filcol - the Color for Filler foreground.

setFillerBackgroundColor

public void setFillerBackgroundColor(java.awt.Color filbac)
Sets the Filler background color option. Default RGB values are 231, 232, and 233.
Parameters:
filbac - the Color for Filler background.

setViewTogether

public void setViewTogether(boolean viwtog)
Sets View Together option true or false. Default is false.
Parameters:
viwtog - the boolean value that specifies to show differences together in one compare view.

setViewSplitVertical

public void setViewSplitVertical(boolean viwver)
Sets View Split Vertical option true or false. Default is true.
Parameters:
viwver - the boolean value that specifies to show differences split vertically side-by-side in compare views.

setMinimumBlocksDiff

public void setMinimumBlocksDiff(boolean minblk)
Sets Minimize Blocks Changed Diff option true or false. Default is false.
Parameters:
minlin - the boolean value that determines which diff algorithm is used - Minimize Lines/Blocks changed.