Class DocumentProcessor

java.lang.Object
  extended by DocumentProcessor

public class DocumentProcessor
extends java.lang.Object

The DocumentProcessor class processes two documents and calculates their similarity score.


Field Summary
private  java.lang.String f1name
           
private  java.lang.String f2name
           
 
Constructor Summary
DocumentProcessor(java.lang.String f1name, java.lang.String f2name)
          Constructor takes as input two file names and saves the values into the data members of the class.
 
Method Summary
 void processDocuments()
          The processDocuments method reads in both file 1 and file 2 and builds a SortedWordList object for each.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

f1name

private java.lang.String f1name

f2name

private java.lang.String f2name
Constructor Detail

DocumentProcessor

public DocumentProcessor(java.lang.String f1name,
                         java.lang.String f2name)
Constructor takes as input two file names and saves the values into the data members of the class.

Parameters:
f1name -
f2name -
Method Detail

processDocuments

public void processDocuments()
The processDocuments method reads in both file 1 and file 2 and builds a SortedWordList object for each. Any words that appear in file 1 but not file 2 must be added to the file 2 object with a count of 0 and vice versa. Once the SortedWordList objects are built, the method will use the SimilarityCalculator to calculate and print the similarity score. Print an error message and exit if either document cannot be opened. Side effect: The similarity score is displayed.