Package jme3utilities.math
Class IntPair
java.lang.Object
jme3utilities.math.IntPair
- All Implemented Interfaces:
Comparable<IntPair>
Represent a pair of distinct integers. Immutable.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Compare to another IntPair, with the smaller elements having priority.boolean
Test for exact equivalence with another Object.int
hashCode()
Generate the hash code for this pair.int
larger()
Read the larger element of the pair.int
smaller()
Read the smaller element of the pair.toString()
Represent this pair as a text string.
-
Field Details
-
logger
message logger for this class
-
-
Constructor Details
-
IntPair
public IntPair(int a, int b) Instantiate a pair.- Parameters:
a
- the first element (≠ b)b
- the 2nd element (≠ a)
-
-
Method Details
-
larger
public int larger()Read the larger element of the pair.- Returns:
- the element value
-
smaller
public int smaller()Read the smaller element of the pair.- Returns:
- the element value
-
compareTo
Compare to another IntPair, with the smaller elements having priority.- Specified by:
compareTo
in interfaceComparable<IntPair>
- Parameters:
otherPair
- (not null)- Returns:
- 0 if this equals otherPair; negative if this comes before otherPair; positive if this comes after otherPair
-
equals
Test for exact equivalence with another Object. -
hashCode
public int hashCode()Generate the hash code for this pair. -
toString
Represent this pair as a text string. The format is: {smaller,larger}
-