Class SortedPair
- java.lang.Object
-
- com.actelion.research.chem.forcefield.mmff.SortedPair
-
- All Implemented Interfaces:
java.lang.Comparable<SortedPair>
public class SortedPair extends java.lang.Object implements java.lang.Comparable<SortedPair>
SortedPair class is used in the Separation table. It holds a pair of integers and ensures that they are sorted such that the first value is larger than the second. The Sorted pair is used to ensure that duplicate values are not stored in the separation table and that the Hashtable can be keyed on both atom indices.
-
-
Constructor Summary
Constructors Constructor Description SortedPair(int a, int b)Construct a new SortedPair.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(SortedPair that)Compares this object with another.booleanequals(java.lang.Object obj)Returns true if this SortedPair is equal with another object.inthashCode()Returns the hash code of this sorted pair object.java.lang.StringtoString()
-
-
-
Method Detail
-
hashCode
public int hashCode()
Returns the hash code of this sorted pair object. Defined as the XOR of the hashes of A and B.- Overrides:
hashCodein classjava.lang.Object- Returns:
- The hash code.
-
equals
public boolean equals(java.lang.Object obj)
Returns true if this SortedPair is equal with another object.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- The object to compare with.- Returns:
- True if SortedPair and object are equal.
-
compareTo
public int compareTo(SortedPair that)
Compares this object with another. This allows collections of SortedPairs to be sorted using the java standard library sorting algorithms.- Specified by:
compareToin interfacejava.lang.Comparable<SortedPair>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-