org.egothor.duplicity.datastructure
Class DocumentPermutatedMins

java.lang.Object
  extended by org.egothor.duplicity.datastructure.DocumentPermutatedMins

public class DocumentPermutatedMins
extends java.lang.Object

Represents container for the informations about duplicities, that are stored in DocumentData class. There are stored records about minimum values for pairs of duplicity checking units and permutations. The duplicity checking unit can be document, paragraph or sentence. Example of stored data:

 permutation  unit    minimum
 1            12#1    33
 1            13#1    31
 1            13#2    10
 2            13#1    45
 

Author:
Kate�ina Dufkov�

Constructor Summary
DocumentPermutatedMins()
           
DocumentPermutatedMins(DocumentPermutatedMins old)
           
 
Method Summary
 void addMinForPermutation(long permID, TextUnitID unitID, long min)
          Adds minimum for given permutation and duplicity checking unit.
 void close()
           
 void commit()
          Computes the number of text units in the document.
 boolean equals(java.lang.Object obj)
           
 java.util.Collection<UnitPermutatedMin> getMinsForPermutation(long permID)
          Returns collection of all UnitPermutatedMin objects for given permutation.
 int getNumberOfTextUnits()
          Returns the number of text units in the document.
 int hashCode()
           
 void releaseMinsForPermutation(long permID)
          Removes from the internal data structure informations about given permutation.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DocumentPermutatedMins

public DocumentPermutatedMins()

DocumentPermutatedMins

public DocumentPermutatedMins(DocumentPermutatedMins old)
Method Detail

getMinsForPermutation

public java.util.Collection<UnitPermutatedMin> getMinsForPermutation(long permID)
Returns collection of all UnitPermutatedMin objects for given permutation. For example above and permID == 1 it would return:
 UnitPermutatedMin(12#1    33)
 UnitPermutatedMin(13#1    31)
 UnitPermutatedMin(13#2    10)
 

Parameters:
permID - identificator of the permutation
Returns:
collection of UnitPermutatedMin objects

addMinForPermutation

public void addMinForPermutation(long permID,
                                 TextUnitID unitID,
                                 long min)
Adds minimum for given permutation and duplicity checking unit. The caller MUST ensure that only one minimum for each permutation and duplicity checking unit will be added, because this method does not test it.

Parameters:
permID - permutation id
unitID - duplicity checking id
min - minimum value

releaseMinsForPermutation

public void releaseMinsForPermutation(long permID)
Removes from the internal data structure informations about given permutation.

Parameters:
permID - permutation to be released

getNumberOfTextUnits

public int getNumberOfTextUnits()
Returns the number of text units in the document.

Returns:
number of text units in the document

commit

public void commit()
            throws DuplicityCheckingException
Computes the number of text units in the document. MUST be called after finish of adding values to the object, but before calling the getNumberOfTextUnits() method.

Throws:
DuplicityCheckingException - if the object data field is empty

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

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

close

public void close()