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 int
compareTo(SortedPair that)
Compares this object with another.boolean
equals(java.lang.Object obj)
Returns true if this SortedPair is equal with another object.int
hashCode()
Returns the hash code of this sorted pair object.java.lang.String
toString()
-
-
-
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:
hashCode
in 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:
equals
in 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:
compareTo
in interfacejava.lang.Comparable<SortedPair>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-