org.egothor.duplicity.datastructure
Class UnitPair

java.lang.Object
  extended by org.egothor.duplicity.file.DuplicityCheckingFileElement
      extended by org.egothor.duplicity.datastructure.UnitPair

public class UnitPair
extends DuplicityCheckingFileElement

Represents single pair of two unit identifications.

Author:
Kate�ina Dufkov�

Field Summary
static java.util.Comparator<UnitPair> comp
          Comparator using first and then second unit id for the class UnitPair.
static java.util.Comparator<UnitPair> compFirst
          Comparator using first unit id for the class UnitPair.
static java.util.Comparator<UnitPair> compSecond
          Comparator using second unit id for the class UnitPair.
 
Constructor Summary
UnitPair()
           
UnitPair(TextUnitID first, TextUnitID second)
           
 
Method Summary
 void copyFrom(UnitPair from)
          Copies the values of all fields from given instance.
 boolean equals(java.lang.Object obj)
           
 TextUnitID getFirstUnitID()
           
 TextUnitID getSecondUnitID()
           
 int hashCode()
           
 boolean isRelatedTo(java.util.Set<DocumentUnitID> set)
          Returns true, if one of the documents from this pair is present in the given set of documents.
 void load(DataInputStream dis)
           
 void store(DataOutputStream dos)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

compFirst

public static java.util.Comparator<UnitPair> compFirst
Comparator using first unit id for the class UnitPair.


compSecond

public static java.util.Comparator<UnitPair> compSecond
Comparator using second unit id for the class UnitPair.


comp

public static java.util.Comparator<UnitPair> comp
Comparator using first and then second unit id for the class UnitPair.

Constructor Detail

UnitPair

public UnitPair()

UnitPair

public UnitPair(TextUnitID first,
                TextUnitID second)
Method Detail

getFirstUnitID

public TextUnitID getFirstUnitID()

getSecondUnitID

public TextUnitID getSecondUnitID()

copyFrom

public void copyFrom(UnitPair from)
Copies the values of all fields from given instance.

Parameters:
from - instance to copy values from

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

store

public void store(DataOutputStream dos)
           throws java.io.IOException
Specified by:
store in class DuplicityCheckingFileElement
Throws:
java.io.IOException

load

public void load(DataInputStream dis)
          throws java.io.IOException
Specified by:
load in class DuplicityCheckingFileElement
Throws:
java.io.IOException

isRelatedTo

public boolean isRelatedTo(java.util.Set<DocumentUnitID> set)
Returns true, if one of the documents from this pair is present in the given set of documents.

Specified by:
isRelatedTo in class DuplicityCheckingFileElement
Parameters:
set - set of document identificators
Returns:
true, if one of the documents from this pair is present in the given set of documents