upidiff.diff
Class BlockChange

java.lang.Object
  |
  +--upidiff.diff.Change
        |
        +--upidiff.diff.BlockChange
All Implemented Interfaces:
Serializable

public final class BlockChange
extends Change

This class represents a block change. A block change consists of 1 or more line changes.

Author:
bmeurer
See Also:
Serialized Form

Field Summary
private  boolean lineChangesVisible
          Whether or not the line changes should be displayed.
private  BlockChange nextBlockChange
          Pointer to the next block change in the link list or null.
private  BlockChange prevBlockChange
          Pointer to the previous block change in the link list or null.
 
Fields inherited from class upidiff.diff.Change
deleted, deletedOffset, inserted, insertedOffset, NEWFILE, next, NOTMERGED, OLDFILE, parent, prev, whichVersion
 
Constructor Summary
(package private) BlockChange(Diff.Change change, boolean lineChangesVisible)
          Creates a new block change using the result of the differencer.
 
Method Summary
(package private)  void calculateLineChanges(boolean charChangesVisible)
          Calculates the lines changes within this block change.
 BlockChange getNextBlockChange()
          Returns a pointer to the next block change or null.
 BlockChange getPrevBlockChange()
          Returns a pointer to the previous block change or null.
 boolean hasLineChanges()
          Checks whether this block change has line changes associated with it.
 boolean isLineChangesVisible()
          Returns whether or not to display line changes for this block change.
 boolean oneLineAlreadyMerged()
          This method queries whether one of the LineChanges in this Line was already merged.
 void setLineChangesVisible(boolean visible)
          Sets whether or not to display line changes for this block change.
 void setNextBlockChange(BlockChange next)
          Sets the pointer to the next block change.
 void setPrevBlockChange(BlockChange prev)
          Sets the pointer to the previous block change.
 
Methods inherited from class upidiff.diff.Change
getDeleted, getDeletedOffset, getInserted, getInsertedOffset, getMergedVersion, getNext, getParent, getPrev, isMerged, setDeleted, setDeletedOffset, setInserted, setInsertedOffset, setMerged, setNext, setParent, setPrev
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lineChangesVisible

private boolean lineChangesVisible
Whether or not the line changes should be displayed.


nextBlockChange

private BlockChange nextBlockChange
Pointer to the next block change in the link list or null.


prevBlockChange

private BlockChange prevBlockChange
Pointer to the previous block change in the link list or null.

Constructor Detail

BlockChange

BlockChange(Diff.Change change,
            boolean lineChangesVisible)
Creates a new block change using the result of the differencer.

Parameters:
change - Change object as returned by the differencer.
lineChangesVisible - Whether or not line changes for this block change should be displayed.
See Also:
Change.Change(Diff.Change,Change)
Method Detail

isLineChangesVisible

public final boolean isLineChangesVisible()
Returns whether or not to display line changes for this block change.

Returns:
true, if line changes should be visible, else false.

setLineChangesVisible

public final void setLineChangesVisible(boolean visible)
Sets whether or not to display line changes for this block change.

Parameters:
visible - Visibility for line changes within this block change.

oneLineAlreadyMerged

public final boolean oneLineAlreadyMerged()
This method queries whether one of the LineChanges in this Line was already merged.

Returns:
Returns true if on of its LineChanges was already merged

getNextBlockChange

public final BlockChange getNextBlockChange()
Returns a pointer to the next block change or null.

Returns:
Pointer to the next block change in the link list.

setNextBlockChange

public final void setNextBlockChange(BlockChange next)
Sets the pointer to the next block change.

Parameters:
next - New next block change in the list or null.

getPrevBlockChange

public final BlockChange getPrevBlockChange()
Returns a pointer to the previous block change or null.

Returns:
Pointer to the previous block in the link list.

setPrevBlockChange

public final void setPrevBlockChange(BlockChange prev)
Sets the pointer to the previous block change.

Parameters:
prev - New previous block change in the list or null.

hasLineChanges

public final boolean hasLineChanges()
Checks whether this block change has line changes associated with it.

Returns:
true if the block change has line changes, else false.

calculateLineChanges

final void calculateLineChanges(boolean charChangesVisible)
Calculates the lines changes within this block change.

Parameters:
charChangesVisible - Whether or not to display char changes by default. This has no effect if lineChangesVisible is false for this block change.