Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

JLibDiff
Class FileData  view FileData download FileData.java

java.lang.Object
  extended byJLibDiff.FileData

public class FileData
extends java.lang.Object

Title: $FileName: FileData.java$

Version:
$VerNum: 3$

Field Summary
private  boolean[] changedFlags
          Array, indexed by real origin-1 line number, containing true for a line that is an insertion or a deletion.
private  int[] equivs
          Vector, indexed by line number, containing an equivalence code for each line.
private  DiffMaker maker
           
private  int numLinesInBuffer
          Number of elements (lines) in this file.
private  int numLinesNotDiscarded
          Total number of nondiscarded lines.
private  int[] realindexes
          Vector mapping virtual line numbers (not counting discarded lines) to real ones (counting those lines).
private  int[] undiscarded
          Vector, like the previous one except that the elements for discarded lines have been squeezed out.
 
Constructor Summary
FileData(java.lang.Object[] data, java.util.Hashtable h, DiffMaker maker)
           
 
Method Summary
(package private)  void clear()
          Allocate changed array for the results of comparison.
private  void discard(byte[] discards)
          Actually discard the lines.
private  byte[] discardable(int[] counts)
          Mark to be discarded each line that matches no line of another file.
(package private)  void discardConfusingLines(FileData f)
          Discard lines that have no matches in another file.
(package private)  int[] equivCount()
          Return equiv_count[I] as the number of lines in this file that fall in equivalence class I.
private  void filterDiscards(byte[] discards)
          Don't really discard the provisional lines except when they occur in a run of discardables, with nonprovisionals at the beginning and end.
 boolean[] getChangedFlags()
          Returns the changedFlags.
 int getNumLinesInBuffer()
          Returns the numLinesInBuffer.
 int getNumLinesNotDiscarded()
          Returns the numLinesNotDiscarded.
 int[] getRealindexes()
          Returns the realindexes.
 int[] getUndiscarded()
          Returns the undiscarded.
(package private)  void shift_boundaries(FileData f)
          Adjust inserts/deletes of blank lines to join changes as much as possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numLinesInBuffer

private int numLinesInBuffer
Number of elements (lines) in this file.


equivs

private int[] equivs
Vector, indexed by line number, containing an equivalence code for each line. It is this vector that is actually compared with that of another file to generate differences.


undiscarded

private int[] undiscarded
Vector, like the previous one except that the elements for discarded lines have been squeezed out.


realindexes

private int[] realindexes
Vector mapping virtual line numbers (not counting discarded lines) to real ones (counting those lines). Both are origin-0.


numLinesNotDiscarded

private int numLinesNotDiscarded
Total number of nondiscarded lines.


changedFlags

private boolean[] changedFlags
Array, indexed by real origin-1 line number, containing true for a line that is an insertion or a deletion. The results of comparison are stored here.


maker

private DiffMaker maker
Constructor Detail

FileData

public FileData(java.lang.Object[] data,
                java.util.Hashtable h,
                DiffMaker maker)
Method Detail

clear

void clear()
Allocate changed array for the results of comparison.


equivCount

int[] equivCount()
Return equiv_count[I] as the number of lines in this file that fall in equivalence class I.


discardConfusingLines

void discardConfusingLines(FileData f)
Discard lines that have no matches in another file. A line which is discarded will not be considered by the actual comparison algorithm; it will be as if that line were not in the file. The file's `realindexes' table maps virtual line numbers (which don't count the discarded lines) into real line numbers; this is how the actual comparison algorithm produces results that are comprehensible when the discarded lines are counted.

When we discard a line, we also mark it as a deletion or insertion so that it will be printed in the output.


discardable

private byte[] discardable(int[] counts)
Mark to be discarded each line that matches no line of another file. If a line matches many lines, mark it as provisionally discardable.


filterDiscards

private void filterDiscards(byte[] discards)
Don't really discard the provisional lines except when they occur in a run of discardables, with nonprovisionals at the beginning and end.


discard

private void discard(byte[] discards)
Actually discard the lines.


shift_boundaries

void shift_boundaries(FileData f)
Adjust inserts/deletes of blank lines to join changes as much as possible. We do something when a run of changed lines include a blank line at one end and have an excluded blank line at the other. We are free to choose which blank line is included. `compareseq' always chooses the one at the beginning, but usually it is cleaner to consider the following blank line to be the "change". The only exception is if the preceding blank line would join this change to other changes.


getUndiscarded

public int[] getUndiscarded()
Returns the undiscarded.


getNumLinesNotDiscarded

public int getNumLinesNotDiscarded()
Returns the numLinesNotDiscarded.


getChangedFlags

public boolean[] getChangedFlags()
Returns the changedFlags.


getRealindexes

public int[] getRealindexes()
Returns the realindexes.


getNumLinesInBuffer

public int getNumLinesInBuffer()
Returns the numLinesInBuffer.