public class AllSimilarUnitPairsFile extends MergeableSimilarUnitPairsFile
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 is used as temporary file, from which the
JaccardCoeficientsFile is created.
Currently, the file is never written to filesystem and is only an abstraction,
because the JaccardCoeficientsFile is created directly
when merging. The out field of the file is used for the created
JaccardCoeficientsFile file.JaccardCoeficientsFile
or a temporary one (in temp directory).JaccardCoeficientsFile,
by a call to mergeToJaccardCoeficientsFile(java.util.ArrayList<org.egothor.duplicity.file.CommonSimilarUnitPairsFile>) method.| Constructor and Description |
|---|
AllSimilarUnitPairsFile(String location,
boolean createTemp)
Initialializes the file.
|
| Modifier and Type | Method and Description |
|---|---|
void |
delete()
Deletes the file from filesystem.
|
String |
getFilename()
Returns the filename corresponding to the
JaccardCoeficientsFile
to be created by this instance. |
JaccardCoeficientsFile |
mergeToJaccardCoeficientsFile(ArrayList<CommonSimilarUnitPairsFile> supfs)
Merges given similar unit pairs files and produces
the
JaccardCoeficientsFile
by aggregating the unit pairs. |
String |
toString() |
dump, getPermID, hasTheSameContent, removegetLocation, getOut, hasTheSameContentpublic AllSimilarUnitPairsFile(String location, boolean createTemp) throws IOException
getFilename()
and will be searched in the location directory.location - path and name of the directory where to create
JaccardCoeficientsFilecreateTemp - sign if the JaccardCoeficientsFile
file should be created in temp directory,
and the file should be rewritten if it already existsFileNotFoundException - if the file could not be createdIOExceptionpublic JaccardCoeficientsFile mergeToJaccardCoeficientsFile(ArrayList<CommonSimilarUnitPairsFile> supfs) throws IOException
JaccardCoeficientsFile
by aggregating the unit pairs.
The JaccardCoeficientsFile will be created on filesystem in the location
specified when creating this AllSimilarUnitPairsFile instance.
Whether a regular or temporary file will be created also depends on
parameter createTemp specified on creation.supfs - list of files to be merged. List can contain regular
(SimilarUnitPairsFile)
or temporary (SimilarUnitPairsTempFile)IOException - on error while reading from this file,
or creating result file, or writing to result filepublic void delete()
DuplicityCheckingFiledelete in class DuplicityCheckingFilepublic String toString()
toString in class CommonSimilarUnitPairsFilepublic String getFilename()
JaccardCoeficientsFile
to be created by this instance.
The location field MUST be already set.
The filename is created in the directory given in the location field
and is in form Constants.JACCARD_COEFICIENTS_FILE_NAME.getFilename in class DuplicityCheckingFileCopyright © 2016 Egothor. All Rights Reserved.