public class SortObject extends java.lang.Object implements java.lang.Comparable<SortObject>
Constructor and Description |
---|
SortObject(int data)
Creates a new SortObject with the given value.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(SortObject other)
Compares this SortObject to the one given and increments the
comparison counter.
|
boolean |
equals(java.lang.Object obj)
Returns true if the given SortObject has the same integer data value as
this one.
|
static int |
getCompares()
Returns the value of the comparison counter.
|
int |
getData()
Returns the integer data value for this SortObject.
|
static void |
resetCompares()
Resets the comparison counter to 0.
|
java.lang.String |
toString()
Returns a String representation, in this case a String containing the
integer data value.
|
public SortObject(int data)
data
- the integer value for this objectpublic static void resetCompares()
public static int getCompares()
public int getData()
public int compareTo(SortObject other)
compareTo
in interface java.lang.Comparable<SortObject>
other
- the item to compare topublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- other object to compare with this onepublic java.lang.String toString()
toString
in class java.lang.Object