SourceJammer 1.2.0.1 May 20, 2002
Copyright (c) 2001, 2002 Robert MacGrogan

JLibDiff
Class diff3

java.lang.Object
  |
  +--JLibDiff.diff3

public class diff3
extends java.lang.Object

The diff3 class compares three files or three BufferedReaders. after comparison, the vector will represente a list of Hunk3 corresponding with blocks of difference.

to generate Hunk3, one can instanciate as follows the class diff3:

     diff3 d = new diff3(file1,file2,file3);
 

which is equivalent to:

     diff3 d = new diff3();
     d.diffFile(file1,file2,file3);
 

To compaire three BufferedReader we have to instanciate as follows:

     diff3 d = new diff3();
     d.diffBuffer(BufferedReader1,BufferedReader2,BufferedReader3);
 

The class diff3 includes methods for examining, printing or saveing blocks of difference:(Hunk3). Here are some more examples of how diff3 can be used:

	diff3 d = new diff3(file1,file2,file3);
	d.print();
     d.save("diff.txt");
 

Example using BufferedReader and ED_format:

 
	BufferedReader in0=new BufferedReader(new FileReader(file1));
	BufferedReader in1=new BufferedReader(new FileReader(file2));
     BufferedReader in2=new BufferedReader(new FileReader(file3)); 
	diff3 d = new diff3();
	d.diffBuffer(in0,in1,in2);
	d.print_ED();
	d.save_ED("diff.txt");
 

See Also:
diff.diff3#getHunk3(), diff.diff3#hunk3At(), diff.diff3#numberOfHunk3(), diff.diff3#print(), diff.diff3#save()

Constructor Summary
diff3()
          Allocates a new diff3 containing no Hunks.
diff3(java.lang.String s0, java.lang.String s1, java.lang.String s2)
          Allocates a new diff3 which contains Hunk3 corresponding to the differences between the three files passed in arguments.
 
Method Summary
 void diffBuffer(java.io.BufferedReader in0, java.io.BufferedReader in1, java.io.BufferedReader in2)
          Compaires three BufferedReaders and updates the vector of Hunk3.
 void diffFile(java.lang.String s0, java.lang.String s1, java.lang.String s2)
          Compaires three files and updates the vector of Hunk3.
 java.util.Vector getHunk3()
          Returns a vector containing Hunk3.
 Hunk3 hunk3At(int i)
          Return the hunk3 at the specified index.
 int numberOfHunk3()
          Returns the number of hunk3 in the vector.
 void print()
          Print Hunk3 with normal format.
 void save(java.lang.String file)
          Save Hunk3 with normal format at the specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

diff3

public diff3()
Allocates a new diff3 containing no Hunks.

diff3

public diff3(java.lang.String s0,
             java.lang.String s1,
             java.lang.String s2)
      throws java.io.IOException
Allocates a new diff3 which contains Hunk3 corresponding to the differences between the three files passed in arguments.
Parameters:
s0 - first file.
s1 - second file.
s2 - therd file.
Method Detail

diffFile

public void diffFile(java.lang.String s0,
                     java.lang.String s1,
                     java.lang.String s2)
              throws java.io.IOException
Compaires three files and updates the vector of Hunk3.
Parameters:
s0 - first file.
s1 - second file.
s2 - therd file.

diffBuffer

public void diffBuffer(java.io.BufferedReader in0,
                       java.io.BufferedReader in1,
                       java.io.BufferedReader in2)
                throws java.io.IOException
Compaires three BufferedReaders and updates the vector of Hunk3.
Parameters:
in0 - first Buffer.
in1 - second Buffer.
in2 - therd Buffer.

getHunk3

public java.util.Vector getHunk3()
Returns a vector containing Hunk3.

hunk3At

public Hunk3 hunk3At(int i)
Return the hunk3 at the specified index.
Parameters:
i - index of the Hunk that will be returned.

numberOfHunk3

public int numberOfHunk3()
Returns the number of hunk3 in the vector.

print

public void print()
Print Hunk3 with normal format.

save

public void save(java.lang.String file)
          throws java.io.IOException
Save Hunk3 with normal format at the specified file.
Parameters:
file - file in which Hunks will be saved.

SourceJammer 1.2.0.1 May 20, 2002
Copyright (c) 2001, 2002 Robert MacGrogan