|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.quick.StringIntPair
StringIntPair constructs an immutable pair object
from a non-null String and an
int.
The methods equals and hashCode are
designed so that two Pair objects whose contents are
equal will be considered equal and will return the same hash code.
| Field Summary | |
private int |
number
The number in the pair. |
static Comparator |
numberFirst
Comparator for sorting
StringIntPair objects by
using the number for the primary sort
and the string to distinguish ties. |
private String |
string
The string in the pair. |
static Comparator |
stringFirst
Comparator for sorting
StringIntPair objects by
using the string for the primary sort
and the number to distinguish ties. |
| Constructor Summary | |
StringIntPair(String string,
int number)
Constructor that constructs the string-int pair using a non- null String and an
int. |
|
| Method Summary | |
boolean |
equals(Object object)
Returns true if the given object is a StringIntPair whose string and number
are equal to the corresponding members of this object. |
int |
getInt()
Returns the number in the pair. |
int |
getNumber()
Returns the number in the pair. |
String |
getString()
Returns the string in the pair. |
int |
hashCode()
Returns the sum of the hashcode of the string with the number. |
String |
toString()
Returns the string combined with the number with a space in between. |
String |
toString(int widthS)
Returns the string padded on the right to widthS combined with the number with a space in between. |
String |
toString(int widthS,
int widthN)
Returns the string padded on the right to widthS combined with the number padded on the left to widthN with a space in between. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
private String string
private int number
public static final Comparator stringFirst
Comparator for sorting
StringIntPair objects by
using the string for the primary sort
and the number to distinguish ties.
The compare throws
ClassCastException if
either argument is not of type
StringIntPair.
public static final Comparator numberFirst
Comparator for sorting
StringIntPair objects by
using the number for the primary sort
and the string to distinguish ties.
The compare throws
ClassCastException if
either argument is not of type
StringIntPair.
| Constructor Detail |
public StringIntPair(String string,
int number)
Constructor that constructs the string-int pair using
a non-null String and an
int.
string - the string for the pairnumber - the number for the pair
NullPointerException - if the string is
null| Method Detail |
public String getString()
public int getInt()
Returns the number in the pair.
Synonym for getNumber.
public int getNumber()
Returns the number in the pair.
Synonym for getInt.
public String toString()
public String toString(int widthS)
public String toString(int widthS,
int widthN)
public boolean equals(Object object)
Returns true if the given object is a
StringIntPair whose string and number
are equal to the corresponding members of this object.
Returns false otherwise.
public int hashCode()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||