Class SimilarUnitPairsTempFile

  extended by org.egothor.duplicity.file.DuplicityCheckingFile
      extended by org.egothor.duplicity.file.CommonSimilarUnitPairsFile
          extended by org.egothor.duplicity.file.SimilarUnitPairsTempFile

public class SimilarUnitPairsTempFile
extends CommonSimilarUnitPairsFile

Represents the "similar unit pairs" file used in duplicity checking algorithm. This class represents the temporary version of this file, which is created when two PermutatedMinsFile instances are merged. This file differs from the SimilarUnitPairsFile in three things:

The file contains instances of UnitPair class. That means it contains pairs {first, second}, where first, second are identificators of units on which we check duplicity (can be document, paragraph or sentence). The file is sorted - the main criteria is first field, in case of tie second field.

The file should be used as follows.
  1. First it should be created using SimilarUnitPairsFileProducer.
  2. It can be merged with another file corresponding to the same permutation by a call to SimilarUnitPairsFile.merge(org.egothor.duplicity.file.SimilarUnitPairsFile, org.egothor.duplicity.file.SimilarUnitPairsTempFile) method.

Kate�ina Dufkov�

Nested Class Summary
Nested classes/interfaces inherited from class org.egothor.duplicity.file.DuplicityCheckingFile
Field Summary
Fields inherited from class org.egothor.duplicity.file.CommonSimilarUnitPairsFile
Fields inherited from class org.egothor.duplicity.file.DuplicityCheckingFile
location, out
Constructor Summary
protected SimilarUnitPairsTempFile(SimilarUnitPairsFileProducer p, java.lang.String location)
          Initialializes the file by writing producer content to disk.
Method Summary
protected  void createOut()
          Creates temporary file and sets the out field.
 java.lang.String getFilename()
          Returns the filename corresponding to this file.
Methods inherited from class org.egothor.duplicity.file.CommonSimilarUnitPairsFile
dump, getPermID, hasTheSameContent, remove, toString
Methods inherited from class org.egothor.duplicity.file.DuplicityCheckingFile
createPermOut, createTempOut, delete, dump, getLocation, getNewTempFile, getOut, hasTheSameContent, initFromProducer, openOut, remove
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


protected SimilarUnitPairsTempFile(SimilarUnitPairsFileProducer p,
                                   java.lang.String location)
Initialializes the file by writing producer content to disk. Sets permID and location fields, creates a file on filesystem for this file and fills it with data from producer object. The filename is in form returned by getFilename() and will be created in the temp directory under the directory given in location parameter. The temp directory must exist. If the file already exists, it will be rewritten.

p - producer object
location - path and name of the directory under which the file will be created, must end with "/" sign
Throws: - if the file could not be created, or writing data to the file failed
Method Detail


protected void createOut()
Creates temporary file and sets the out field. Uses the DuplicityCheckingFile.createTempOut() method.

Specified by:
createOut in class DuplicityCheckingFile
Throws: - if the file could not be created
See Also:


public java.lang.String getFilename()
Returns the filename corresponding to this file. The location and permID fields MUST be already set. The filename is created in temp directory under the directory given in location field and is in form Constants.SIMILAR_UNIT_PAIRS_FILE_PREFIX<permID>.

Specified by:
getFilename in class DuplicityCheckingFile