public class SimilarUnitPairsFileProducer extends Object
SimilarUnitPairsFile and
SimilarUnitPairsTempFile classes.
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 class should be used as follows.
add(org.egothor.duplicity.datastructure.TextUnitID, org.egothor.duplicity.datastructure.TextUnitID).commit(java.lang.String) (or commitTemp(java.lang.String))
sorts and writes data to filesystem and returns instance of
SimilarUnitPairsFile
(or SimilarUnitPairsTempFile) class.| Constructor and Description |
|---|
SimilarUnitPairsFileProducer(long permID)
Initializes the object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(TextUnitID first,
TextUnitID second)
Adds new
UnitPair to the file. |
SimilarUnitPairsFile |
commit(String location)
Commit the changes in the buffer to filesystem file.
|
SimilarUnitPairsTempFile |
commitTemp(String location)
Commit the changes in the buffer to temporary filesystem file.
|
List<UnitPair> |
getBuffer() |
long |
getPermID() |
String |
toString() |
public SimilarUnitPairsFileProducer(long permID)
permID - permutation assigned to this filepublic long getPermID()
public void add(TextUnitID first, TextUnitID second)
UnitPair to the file.
Asserts that only pairs {first, second} where first < second are inserted.
For a pair that does not satisfy the condition method switches its parameters
and adds {second, first} pair instead.
It does NOT need to create an own copy of arguments because the arguments are immutable.first - first unit id for the UnitPair object to be addedsecond - second unit id for the UnitPair object to be addedpublic SimilarUnitPairsFile commit(String location)
location - location to which the file should be writtenSimilarUnitPairsFile
representing the filepublic SimilarUnitPairsTempFile commitTemp(String location)
location - location to which the file should be writtenSimilarUnitPairsTempFile
representing the fileCopyright © 2016 Egothor. All Rights Reserved.