|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectcomp202.fall2007.a5.comparator.SongComparator
public abstract class SongComparator
A SongComparator
object defines an order on Song
s.
This order is total; that is, it is defined for any pair of
Song
s. However, it is possible that this order is not
strict; that is, it is possible that for certain pairs of
Song
s, neither Song
appears before or after
the other. This situation occurs when the order defined by a
SongComparator
is based on some attributes of
Song
s, and the two Song
s in the pair have
equal values for these attributes.
Constructor Summary | |
---|---|
SongComparator()
Creates a new SongComparator . |
Method Summary | |
---|---|
abstract int |
compareTo(Song left,
Song right)
Compares the two specified Song s and determines whether or
not one occurs before the other in the order defined by this
SongComparator . |
abstract String |
toString()
Returns a String representation of this
SongComparator , which describes the order it defines. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SongComparator()
SongComparator
.
Method Detail |
---|
public abstract int compareTo(Song left, Song right)
Compares the two specified Song
s and determines whether or
not one occurs before the other in the order defined by this
SongComparator
.
If the first specified Song
occurs before the second
specified Song
in the order defined by this
SongComparator
, this method returns a negative number. If
the second specified Song
occurs before the first
specified Song
in the order defined by this
SongComparator
, this method returns a positive number. If
neither of the specified Song
appears before the other in
the order defined by this SongComparator
, this method
returns 0
.
left
- A Song
.right
- Another Song
.
0
, or a positive number if
left
occurs before, neither before nor after, or
after right
, respectively.public abstract String toString()
String
representation of this
SongComparator
, which describes the order it defines.
toString
in class Object
String
representation of this
StringComparator
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |