com.starbase.diff
Class BasicCompare

java.lang.Object
  |
  +--com.starbase.diff.BasicCompare
All Implemented Interfaces:
DiffCompare

public class BasicCompare
extends java.lang.Object
implements DiffCompare

BasicCompare is a implementation of the DiffCompare interface that can be used to compare two files with many different options. This class supports column masking (ignoring chars in a column), ignoring case and different white space ignore options. See also DiffOptions for case and whitespace options.


Field Summary
static int COMPARE_EOL
          Compare EOL characters when comparing two lines.
static int DIFF_B_WS
          A predfined flag for how Unix diff treats whitespace using the -b flag.
static int DIFF_W_WS
          A predfined flag for how Unix diff treats whitespace using the -w flag.
static int IGNORE_CASE
          Ignore case when comparing two lines.
static int INTERIOR_WS_EQUIV
          Treat interior whitespace as equivalent to a single space character.
static int INTERIOR_WS_IGNORE
          Ignore interior whitespace.
static int LEADING_WS_EQUIV
          Treat leading whitespace as equivalent to a single space character.
static int LEADING_WS_IGNORE
          Ignore leading whitespace.
static int PVCS_WS
          A predfined flag for how PVCS ignores whitespace using -B option.
static int TRAILING_WS_EQUIV
          Treat trialing whitespace as equivalent to a single space character.
static int TRAILING_WS_IGNORE
          Ignore trialing whitespace.
static int VSS_WS
          A predfined flag for how VSS, StarTeam 2.0 and WinDiff and Unix diff -w ignores whitespace.
 
Constructor Summary
BasicCompare()
          Can be used for binary comparison.
BasicCompare(int flags, ColumnMask[] columnMask)
          columnMask is an array of column numbers to ignore.
 
Method Summary
 boolean equalObjects(java.lang.Object src, java.lang.Object trg)
          Return true if the two arguments are "equal".
 int hashObject(java.lang.Object object)
          Compute a hash value for the object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEADING_WS_IGNORE

public static final int LEADING_WS_IGNORE
Ignore leading whitespace.

See Also:
Constant Field Values

LEADING_WS_EQUIV

public static final int LEADING_WS_EQUIV
Treat leading whitespace as equivalent to a single space character.

See Also:
Constant Field Values

INTERIOR_WS_IGNORE

public static final int INTERIOR_WS_IGNORE
Ignore interior whitespace.

See Also:
Constant Field Values

INTERIOR_WS_EQUIV

public static final int INTERIOR_WS_EQUIV
Treat interior whitespace as equivalent to a single space character.

See Also:
Constant Field Values

TRAILING_WS_IGNORE

public static final int TRAILING_WS_IGNORE
Ignore trialing whitespace.

See Also:
Constant Field Values

TRAILING_WS_EQUIV

public static final int TRAILING_WS_EQUIV
Treat trialing whitespace as equivalent to a single space character.

See Also:
Constant Field Values

COMPARE_EOL

public static final int COMPARE_EOL
Compare EOL characters when comparing two lines.

See Also:
Constant Field Values

IGNORE_CASE

public static final int IGNORE_CASE
Ignore case when comparing two lines.

See Also:
Constant Field Values

PVCS_WS

public static final int PVCS_WS
A predfined flag for how PVCS ignores whitespace using -B option. PVCS ignores all whitespace at the begining and end of a line. Any whitespace in the interior is left alone. For example the following two strings would be considered equivalent: " Hi Mom " and "Hi Mom". It is defined as: (LEADING_WS_IGNORE | TRAILING_WS_IGNORE)

See Also:
Constant Field Values

VSS_WS

public static final int VSS_WS
A predfined flag for how VSS, StarTeam 2.0 and WinDiff and Unix diff -w ignores whitespace. All whitespace on a line is ignored. For example, the following two strings would be considered equivalent: " Hi Mom " and "HiMom". It is defined as: (LEADING_WS_IGNORE | INTERIOR_WS_IGNORE | TRAILING_WS_IGNORE)

See Also:
Constant Field Values

DIFF_W_WS

public static final int DIFF_W_WS
A predfined flag for how Unix diff treats whitespace using the -w flag. It ignored all whitespace on a line. It is defined as: (LEADING_WS_IGNORE | INTERIOR_WS_IGNORE | TRAILING_WS_IGNORE)

See Also:
Constant Field Values

DIFF_B_WS

public static final int DIFF_B_WS
A predfined flag for how Unix diff treats whitespace using the -b flag. It ignores all trailing whitespace and considers all interior whitespace to be equivalent. For example the line " Hi Mom " would match " Hi Mom" but not "Hi Mom". It is defined as: (LEADING_WS_EQUIV | INTERIOR_WS_EQUIV | TRAILING_WS_IGNORE)

See Also:
Constant Field Values
Constructor Detail

BasicCompare

public BasicCompare(int flags,
                    ColumnMask[] columnMask)
columnMask is an array of column numbers to ignore. It can be null.


BasicCompare

public BasicCompare()
Can be used for binary comparison. Does no case folding, white space ignore nor column masking.

Method Detail

hashObject

public int hashObject(java.lang.Object object)
Description copied from interface: DiffCompare
Compute a hash value for the object.

Specified by:
hashObject in interface DiffCompare

equalObjects

public boolean equalObjects(java.lang.Object src,
                            java.lang.Object trg)
Description copied from interface: DiffCompare
Return true if the two arguments are "equal".

Specified by:
equalObjects in interface DiffCompare


StarTeam SDK 10.4, Build 36
Copyright © 2003-2008 Borland Software Corporation. All rights reserved.