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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCompare to another IntPair, with the smaller elements having priority.booleanTest for exact equivalence with another Object.inthashCode()Generate the hash code for this pair.intlarger()Read the larger element of the pair.intsmaller()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:
compareToin 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}
-