com.flexive.shared
Class FxDiff.Difference

java.lang.Object
  extended by com.flexive.shared.FxDiff.Difference
Enclosing class:
FxDiff

public static class FxDiff.Difference
extends java.lang.Object

Represents a difference, as used in FxDiff. 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
static int NONE
           
 
Constructor Summary
FxDiff.Difference(int delStart, int delEnd, int addStart, int addEnd)
          Creates the difference for the given start and end points for the deletion and addition.
 
Method Summary
 boolean equals(java.lang.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.
 int hashCode()
           
 boolean isAdd()
          Does this difference contain an addition?
 boolean isDelete()
          Does this difference contain a deletion?
 void setAdded(int line)
          Sets the point as added.
 void setDeleted(int line)
          Sets the point as deleted.
 java.lang.String toString()
          Returns a string representation of this difference.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
See Also:
Constant Field Values
Constructor Detail

FxDiff.Difference

public FxDiff.Difference(int delStart,
                         int delEnd,
                         int addStart,
                         int addEnd)
Creates the difference for the given start and end points for the deletion and addition.

Parameters:
delStart - point at which the deletion starts
delEnd - point at which the deletion ends
addStart - point at which the addition starts
addEnd - point at which the addition ends
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.

Returns:
point at which the deletion starts

getDeletedEnd

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

Returns:
point at which the deletion ends

getAddedStart

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

Returns:
point at which the addition starts

getAddedEnd

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

Returns:
point at which the addition ends

setDeleted

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

Parameters:
line - line number

setAdded

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

Parameters:
line - line number

isAdd

public boolean isAdd()
Does this difference contain an addition?

Returns:
add?

isDelete

public boolean isDelete()
Does this difference contain a deletion?

Returns:
delete?

equals

public boolean equals(java.lang.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 java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

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

Overrides:
toString in class java.lang.Object