java.lang.Comparable<PairOfIndices>public class PairOfIndices extends java.lang.Object implements java.lang.Comparable<PairOfIndices>
| Constructor | Description |
|---|---|
PairOfIndices() |
Sole constructor.
|
PairOfIndices(int index1,
int index2) |
Constructor setting both indices.
|
| Modifier and Type | Method | Description |
|---|---|---|
int |
compareTo(PairOfIndices otherPairOfIndices) |
Compares this pair of indices to a given pair of indices
|
boolean |
equals(java.lang.Object otherPair) |
Tells of other pair of objects is equal to this pair of objects.
|
int |
getIndex1() |
Gets the first index
|
int |
getIndex2() |
Gets the second index
|
int |
hashCode() |
Gets has code of this pair of indices.
|
void |
setIndex1(int index1) |
Sets the first index
|
void |
setIndex2(int index2) |
Sets the second index
|
java.lang.String |
toString() |
Gets string representation of this pair of indices.
|
PairOfIndices |
update(int index1,
int index2) |
Sets both indices
|
public PairOfIndices()
public PairOfIndices(int index1,
int index2)
index1 - first index to setindex2 - second index to setInvalidValueException - when any index is smaller than zeropublic int getIndex1()
public int getIndex2()
public void setIndex1(int index1)
index1 - the first indexInvalidValueException - when the index is smaller than zeropublic void setIndex2(int index2)
index2 - the second indexInvalidValueException - when the index is smaller than zeropublic PairOfIndices update(int index1, int index2)
index1 - the first indexindex2 - the second indexInvalidValueException - when any of the indices is smaller than zeropublic int compareTo(PairOfIndices otherPairOfIndices)
compareTo in interface java.lang.Comparable<PairOfIndices>otherPairOfIndices - other pair of indices to be compared with this pairpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object otherPair)
equals in class java.lang.ObjectotherPair - other pair of objectstrue if other pair of objects is equal to this pair of objectspublic java.lang.String toString()
toString in class java.lang.Object