|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.egothor.duplicity.file.SimilarUnitPairsFileProducer
public class SimilarUnitPairsFileProducer
Represents the "similar unit pairs" file used in duplicity checking algorithm,
before if was written to the filesystem. Allows producing new instances
of 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 Summary | |
---|---|
SimilarUnitPairsFileProducer(long permID)
Initializes the object. |
Method Summary | |
---|---|
void |
add(TextUnitID first,
TextUnitID second)
Adds new UnitPair to the file. |
SimilarUnitPairsFile |
commit(java.lang.String location)
Commit the changes in the buffer to filesystem file. |
SimilarUnitPairsTempFile |
commitTemp(java.lang.String location)
Commit the changes in the buffer to temporary filesystem file. |
java.util.List<UnitPair> |
getBuffer()
|
long |
getPermID()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SimilarUnitPairsFileProducer(long permID)
permID
- permutation assigned to this fileMethod Detail |
---|
public java.util.List<UnitPair> getBuffer()
public 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(java.lang.String location)
location
- location to which the file should be written
SimilarUnitPairsFile
representing the filepublic SimilarUnitPairsTempFile commitTemp(java.lang.String location)
location
- location to which the file should be written
SimilarUnitPairsTempFile
representing the filepublic java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |