org.egothor.duplicity.file
Class PermutatedMinsFileProducer

java.lang.Object
  extended by org.egothor.duplicity.file.PermutatedMinsFileProducer

public class PermutatedMinsFileProducer
extends java.lang.Object

Represents the "minimums of permutated unit identificators" file used in duplicity checking algorithm, before if was written to the filesystem. Allows producing new instances of PermutatedMinsFile class. The file contains instances of UnitPermutatedMin class. That means it contains pairs {min(pi(T(d))), d}, where:

The class should be used as follows.
  1. The class must be constructed by its constructor.
  2. Barrels can be added by a call to add(org.egothor.core.DocumentData).
  3. Committing barrels by a call to commit(java.lang.String) sorts and writes data to filesystem and returns instance of PermutatedMinsFile class.

Author:
Kate�ina Dufkov�

Constructor Summary
PermutatedMinsFileProducer(long permID)
          Initializes the object.
 
Method Summary
 void add(DocumentData doc)
          Adds document to the file.
 PermutatedMinsFile commit(java.lang.String location)
          Commit the changes in the buffer to the main file.
 java.util.List<UnitPermutatedMin> 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

PermutatedMinsFileProducer

public PermutatedMinsFileProducer(long permID)
Initializes the object.

Parameters:
permID - permutation assigned to this file
Method Detail

getBuffer

public java.util.List<UnitPermutatedMin> getBuffer()

getPermID

public long getPermID()

add

public void add(DocumentData doc)
Adds document to the file. It takes the duplicityMins of the DocumentData object, and appends every field of the map that corresponds to our permutation to its content to the internal buffer. The appended fields are then released from the DocumentPermutatedMins field of DocumentData object.

Parameters:
doc - document to be added

commit

public PermutatedMinsFile commit(java.lang.String location)
Commit the changes in the buffer to the main file.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object