com.borland.primetime.util
Class Diff.DiffEntry

java.lang.Object
  |
  +--com.borland.primetime.util.Diff.DiffEntry
Enclosing class:
Diff

public class Diff.DiffEntry
extends java.lang.Object

A DiffEntry is used to describe a region of lines that are changed from an ORIGINAL file to a NEW file. A diff between two files consists of a number of DiffEntries All line numbers are 1-based. A DiffEntry basically consists of two parts: 1. A startLine and count field that show which lines have to be deleted from the ORIGINAL file, and where to add the newLines from the NEW file 2. An array of Strings containing the lines from the NEW file that either replace lines in the ORIGINAL file, or are added outright. We use a type field to quickly distinguish between three scenarios: ADD: Several lines are added to the ORIGINAL file startLine = line in the ORIGINAL after which the lines get added count = 0 newLines = the lines that get added CHANGE: Lines are changed between the files startLine = first line in the ORIGINAL that gets changed count = number of lines that change count == newLines.length newLines = the lines that replace the original lines DELETE: Lines are deleted from the original file startLine = first line in the ORIGINAL that gets deleted count = number of lines that get deleted newLines = emptyLines


Field Summary
static int ADD
          the allowed values for the type
static int CHANGE
           
 int count
          the number of lines in the ORIGINAL file that get changed
static int DELETE
           
 java.lang.String[] newLines
          the lines from the NEW file that replace [startLine...startLine+length[ in the ORIGINAL file
 int startLine
          the start line in the ORIGINAL file
 int type
          the type of the diff
 
Constructor Summary
Diff.DiffEntry(int type, int start, int count, java.lang.String[] lines)
          Create a DiffEntry object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADD

public static final int ADD
the allowed values for the type

CHANGE

public static final int CHANGE

DELETE

public static final int DELETE

type

public int type
the type of the diff

startLine

public int startLine
the start line in the ORIGINAL file

count

public int count
the number of lines in the ORIGINAL file that get changed

newLines

public java.lang.String[] newLines
the lines from the NEW file that replace [startLine...startLine+length[ in the ORIGINAL file
Constructor Detail

Diff.DiffEntry

public Diff.DiffEntry(int type,
                      int start,
                      int count,
                      java.lang.String[] lines)
Create a DiffEntry object.
Parameters:
type - the type as in ADD | CHANGE | DELETE
start - where does the modification start
count - how many lines deleted, added, or changed. if added or changed, this should be the size of the lines array.
lines - the array of lines to be added when the type is ADD or CHANGE. This parameter should be null for DELETE types.