JIDE 3.5.15

com.jidesoft.diff
Class Difference

java.lang.Object
  extended by com.jidesoft.diff.Difference
Direct Known Subclasses:
Conflict

public class Difference
extends Object

Represents a difference, as used in Diff. A difference consists of two pairs of starting and ending points, each pair representing either the "from" or the "to" collection passed to Diff. If an ending point is -1, then the difference was either a deletion or an addition. For example, if getDeletedEnd() returns -1, then the difference represents an addition.


Field Summary
protected  int _addedEnd
          The point at which the addition ends.
protected  int _addedStart
          The point at which the addition starts.
protected  boolean _conflicting
           
protected  int _deletedEnd
          The point at which the deletion ends.
protected  int _deletedStart
          The point at which the deletion starts.
static int NONE
           
 
Constructor Summary
  Difference(int deletedStart, int deletedEnd, int addedStart, int addedEnd)
          Creates the difference for the given start and end points for the deletion and addition.
protected Difference(int deletedStart, int deletedEnd, int addedStart, int addedEnd, boolean conflicting)
          Creates the difference for the given start and end points for the deletion and addition.
 
Method Summary
 void adjustAdded(int lineChanges)
          Adjusts point as added.
 void adjustDeleted(int lineChanges)
          Adjusts the point as deleted.
 boolean contains(int i)
           
 boolean equal(int i)
           
 boolean equals(Object obj)
          Compares this object to the other for equality.
 int getAddedEnd()
          The point at which the addition ends, if any.
 int getAddedStart()
          The point at which the addition starts, if any.
 int getDeletedEnd()
          The point at which the deletion ends, if any.
 int getDeletedStart()
          The point at which the deletion starts, if any.
 void setAdded(int line)
          Sets the point as added.
 void setDeleted(int line)
          Sets the point as deleted.
 String toString()
          Returns a string representation of this difference.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
See Also:
Constant Field Values

_deletedStart

protected int _deletedStart
The point at which the deletion starts.


_deletedEnd

protected int _deletedEnd
The point at which the deletion ends.


_addedStart

protected int _addedStart
The point at which the addition starts.


_addedEnd

protected int _addedEnd
The point at which the addition ends.


_conflicting

protected boolean _conflicting
Constructor Detail

Difference

public Difference(int deletedStart,
                  int deletedEnd,
                  int addedStart,
                  int addedEnd)
Creates the difference for the given start and end points for the deletion and addition.


Difference

protected Difference(int deletedStart,
                     int deletedEnd,
                     int addedStart,
                     int addedEnd,
                     boolean conflicting)
Creates the difference for the given start and end points for the deletion and addition.

Method Detail

getDeletedStart

public int getDeletedStart()
The point at which the deletion starts, if any. A value equal to NONE means this is an addition.


getDeletedEnd

public int getDeletedEnd()
The point at which the deletion ends, if any. A value equal to NONE means this is an addition.


getAddedStart

public int getAddedStart()
The point at which the addition starts, if any. A value equal to NONE means this must be an addition.


getAddedEnd

public int getAddedEnd()
The point at which the addition ends, if any. A value equal to NONE means this must be an addition.


setDeleted

public void setDeleted(int line)
Sets the point as deleted. The start and end points will be modified to include the given line.


adjustDeleted

public void adjustDeleted(int lineChanges)
Adjusts the point as deleted. The start and end points will be modified to include the given line.


adjustAdded

public void adjustAdded(int lineChanges)
Adjusts point as added. The start and end points will be modified to include the given line.


setAdded

public void setAdded(int line)
Sets the point as added. The start and end points will be modified to include the given line.


equals

public boolean equals(Object obj)
Compares this object to the other for equality. Both objects must be of type Difference, with the same starting and ending points.

Overrides:
equals in class Object

equal

public boolean equal(int i)

contains

public boolean contains(int i)

toString

public String toString()
Returns a string representation of this difference.

Overrides:
toString in class Object

JIDE 3.5.15