|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectcomp202.fall2007.a5.comparator.ComparatorFactory
public class ComparatorFactory
A ComparatorFactory
creates SongComparator
objects that define certain orders on Song
s based on their
attributes.
Field Summary | |
---|---|
static SongComparator |
ASCENDING_ALBUM_COMPARATOR
A SongComparator which defines an order based on the album
title attributes of Song s. |
static SongComparator |
ASCENDING_ALBUM_DISC_TRACK_COMPARATOR
A SongComparator which defines an order equivalent to
applying ASCENDING_ALBUM_COMPARATOR ,
ASCENDING_DISC_COMPARATOR , and
ASCENDING_TRACK_COMPARATOR , in that order, until one of
them determines that a Song occurs before or after the
other, or until all three have been tried without one of them determining
that one Song occurs before or after another. |
static SongComparator |
ASCENDING_ARTIST_ALBUM_DISC_TRACK_COMPARATOR
A SongComparator which defines an order equivalent to
applying ASCENDING_ARTIST_COMPARATOR ,
ASCENDING_ALBUM_COMPARATOR ,
ASCENDING_DISC_COMPARATOR , and
ASCENDING_TRACK_COMPARATOR , in that order, until one of
them determines that a Song occurs before or after the
other, or until all four have been tried without one of them determining
that one Song occurs before or after another. |
static SongComparator |
ASCENDING_ARTIST_COMPARATOR
A SongComparator which defines an order based on the
artist name attributes of Song s. |
static SongComparator |
ASCENDING_DISC_COMPARATOR
A SongComparator which defines an order based on the disc
number attributes of Song s. |
static SongComparator |
ASCENDING_DISC_TRACK_COMPARATOR
A SongComparator which defines an order equivalent to
applying ASCENDING_DISC_COMPARATOR and
ASCENDING_TRACK_COMPARATOR , in that order, until one of
them determines that a Song occurs before or after the
other, or until both have been tried without one of them determining that
one Song occurs before or after another. |
static SongComparator |
ASCENDING_LENGTH_COMPARATOR
A SongComparator which defines an order based on the
length attributes of Song s. |
static SongComparator |
ASCENDING_PATH_COMPARATOR
A SongComparator which defines an order based on the path
attributes of Song . |
static SongComparator |
ASCENDING_TITLE_COMPARATOR
A SongComparator which defines an order based on the track
title attributes of Song s. |
static SongComparator |
ASCENDING_TRACK_COMPARATOR
A SongComparator which defines an order based on the track
number attributes of Song s. |
static SongComparator |
DESCENDING_ALBUM_COMPARATOR
A SongComparator which defines an order based on the album
title attributes of Song s. |
static SongComparator |
DESCENDING_ALBUM_DISC_TRACK_COMPARATOR
A SongComparator which defines an order equivalent to
applying DESCENDING_ALBUM_COMPARATOR ,
DESCENDING_DISC_COMPARATOR , and
DESCENDING_TRACK_COMPARATOR , in that order, until one of
them determines that a Song occurs before or after the
other, or until all three have been tried without one of them determining
that one Song occurs before or after another. |
static SongComparator |
DESCENDING_ARTIST_ALBUM_DISC_TRACK_COMPARATOR
A SongComparator which defines an order equivalent to
applying DESCENDING_ARTIST_COMPARATOR ,
DESCENDING_ALBUM_COMPARATOR ,
DESCENDING_DISC_COMPARATOR , and
DESCENDING_TRACK_COMPARATOR , in that order, until one of
them determines that a Song occurs before or after the
other, or until all four have been tried without one of them determining
that one Song occurs before or after another. |
static SongComparator |
DESCENDING_ARTIST_COMPARATOR
A SongComparator which defines an order based on the
artist name attributes of Song s. |
static SongComparator |
DESCENDING_DISC_COMPARATOR
A SongComparator which defines an order based on the disc
number attributes of Song s. |
static SongComparator |
DESCENDING_DISC_TRACK_COMPARATOR
A SongComparator which defines an order equivalent to
applying DESCENDING_DISC_COMPARATOR and
DESCENDING_TRACK_COMPARATOR , in that order, until one of
them determines that a Song occurs before or after the
other, or until both have been tried without one of them determining that
one Song occurs before or after another. |
static SongComparator |
DESCENDING_LENGTH_COMPARATOR
A SongComparator which defines an order based on the
length attributes of Song s. |
static SongComparator |
DESCENDING_PATH_COMPARATOR
A SongComparator which defines an order based on the path
attributes of Song s. |
static SongComparator |
DESCENDING_TITLE_COMPARATOR
A SongComparator which defines an order based on the track
title attributes of Song s. |
static SongComparator |
DESCENDING_TRACK_COMPARATOR
A SongComparator which defines an order based on the track
number attributes of Song s. |
Constructor Summary | |
---|---|
ComparatorFactory()
Creates a new ComparatorFactory . |
Method Summary | |
---|---|
SongComparator |
createMultiComparator(java.util.ArrayList<SongComparator> subComparators)
Creates a new SongComparator which defines an order that
is the combination of the individual SongComparator s in
the specified ArrayList . |
SongComparator |
createMultiComparator(SongComparator[] subComparators)
Creates a new SongComparator which defines an order that
is the combination of the individual SongComparator s in
the specified array. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final SongComparator ASCENDING_ARTIST_COMPARATOR
SongComparator
which defines an order based on the
artist name attributes of Song
s. In this order, a
Song
is defined to appear before another if the value of
its artist name attribute appears lexicographically before the
value of the artist name attribute of the other Song
,
using a case-insensitive comparison.
public static final SongComparator DESCENDING_ARTIST_COMPARATOR
SongComparator
which defines an order based on the
artist name attributes of Song
s. In this order, a
Song
is defined to appear before another if the value of
its artist name attribute appears lexicographically after the
value of the artist name attribute of the other Song
,
using a case-insensitive comparison.
public static final SongComparator ASCENDING_ALBUM_COMPARATOR
SongComparator
which defines an order based on the album
title attributes of Song
s. In this order, a
Song
is defined to appear before another if the value of
its album title attribute appears lexicographically before the
value of the album title attribute of the other Song
,
using a case-insensitive comparison.
public static final SongComparator DESCENDING_ALBUM_COMPARATOR
SongComparator
which defines an order based on the album
title attributes of Song
s. In this order, a
Song
is defined to appear before another if the value of
its album title attribute appears lexicographically after the
value of the album title attribute of the other Song
,
using a case-insensitive comparison.
public static final SongComparator ASCENDING_DISC_COMPARATOR
SongComparator
which defines an order based on the disc
number attributes of Song
s. In this order, a
Song
is defined to appear before another if the value of
its disc number attribute is less than the value of the disc
number attribute of the other Song
.
public static final SongComparator DESCENDING_DISC_COMPARATOR
SongComparator
which defines an order based on the disc
number attributes of Song
s. In this order, a
Song
is defined to appear before another if the value of
its disc number attribute is greater than the value of the disc
number attribute of the other Song
.
public static final SongComparator ASCENDING_TRACK_COMPARATOR
SongComparator
which defines an order based on the track
number attributes of Song
s. In this order, a
Song
is defined to appear before another if the value of
its track number attribute is less than the value of the track
number attribute of the other Song
.
public static final SongComparator DESCENDING_TRACK_COMPARATOR
SongComparator
which defines an order based on the track
number attributes of Song
s. In this order, a
Song
is defined to appear before another if the value of
its track number attribute is greater than the value of the track
number attribute of the other Song
.
public static final SongComparator ASCENDING_PATH_COMPARATOR
SongComparator
which defines an order based on the path
attributes of Song
. In this order, a Song
is defined to appear before another if the path of the file containing
the corresponding audio track appears before the path of the file
containing the audio track corresponding of the other Song
,
using the natural order defined by the compareTo()
method
of the File
class.
public static final SongComparator DESCENDING_PATH_COMPARATOR
SongComparator
which defines an order based on the path
attributes of Song
s. In this order, a Song
is defined to appear before another if the path of the file containing
the corresponding audio track appears after the path of the file
containing the audio track corresponding to the other Song
,
using the natural order defined by the compareTo()
method
of the File
class.
public static final SongComparator ASCENDING_TITLE_COMPARATOR
SongComparator
which defines an order based on the track
title attributes of Song
s. In this order, a
Song
is defined to appear before another if the value of
its track title attribute appears lexicographically before the
value of the track title attribute of the other Song
,
using a case-insensitive comparison.
public static final SongComparator DESCENDING_TITLE_COMPARATOR
SongComparator
which defines an order based on the track
title attributes of Song
s. In this order, a
Song
is defined to appear before another if the value of
its track title attribute appears lexicographically after the
value of the track title attribute of the other Song
,
using a case-insensitive comparison.
public static final SongComparator ASCENDING_LENGTH_COMPARATOR
SongComparator
which defines an order based on the
length attributes of Song
s. In this order, a
Song
is defined to appear before another if the value of
its length attribute is less than the value of the length
attribute of the other Song
.
public static final SongComparator DESCENDING_LENGTH_COMPARATOR
SongComparator
which defines an order based on the
length attributes of Song
s. In this order, a
Song
is defined to appear before another if the value of
its length attribute is greater than the value of the length
attribute of the other Song.
public static final SongComparator ASCENDING_DISC_TRACK_COMPARATOR
SongComparator
which defines an order equivalent to
applying ASCENDING_DISC_COMPARATOR
and
ASCENDING_TRACK_COMPARATOR
, in that order, until one of
them determines that a Song
occurs before or after the
other, or until both have been tried without one of them determining that
one Song
occurs before or after another.
public static final SongComparator DESCENDING_DISC_TRACK_COMPARATOR
SongComparator
which defines an order equivalent to
applying DESCENDING_DISC_COMPARATOR
and
DESCENDING_TRACK_COMPARATOR
, in that order, until one of
them determines that a Song
occurs before or after the
other, or until both have been tried without one of them determining that
one Song
occurs before or after another.
public static final SongComparator ASCENDING_ALBUM_DISC_TRACK_COMPARATOR
SongComparator
which defines an order equivalent to
applying ASCENDING_ALBUM_COMPARATOR
,
ASCENDING_DISC_COMPARATOR
, and
ASCENDING_TRACK_COMPARATOR
, in that order, until one of
them determines that a Song
occurs before or after the
other, or until all three have been tried without one of them determining
that one Song
occurs before or after another.
public static final SongComparator DESCENDING_ALBUM_DISC_TRACK_COMPARATOR
SongComparator
which defines an order equivalent to
applying DESCENDING_ALBUM_COMPARATOR
,
DESCENDING_DISC_COMPARATOR
, and
DESCENDING_TRACK_COMPARATOR
, in that order, until one of
them determines that a Song
occurs before or after the
other, or until all three have been tried without one of them determining
that one Song
occurs before or after another.
public static final SongComparator ASCENDING_ARTIST_ALBUM_DISC_TRACK_COMPARATOR
SongComparator
which defines an order equivalent to
applying ASCENDING_ARTIST_COMPARATOR
,
ASCENDING_ALBUM_COMPARATOR
,
ASCENDING_DISC_COMPARATOR
, and
ASCENDING_TRACK_COMPARATOR
, in that order, until one of
them determines that a Song
occurs before or after the
other, or until all four have been tried without one of them determining
that one Song
occurs before or after another.
public static final SongComparator DESCENDING_ARTIST_ALBUM_DISC_TRACK_COMPARATOR
SongComparator
which defines an order equivalent to
applying DESCENDING_ARTIST_COMPARATOR
,
DESCENDING_ALBUM_COMPARATOR
,
DESCENDING_DISC_COMPARATOR
, and
DESCENDING_TRACK_COMPARATOR
, in that order, until one of
them determines that a Song
occurs before or after the
other, or until all four have been tried without one of them determining
that one Song
occurs before or after another.
Constructor Detail |
---|
public ComparatorFactory()
ComparatorFactory
.
Method Detail |
---|
public SongComparator createMultiComparator(java.util.ArrayList<SongComparator> subComparators)
Creates a new SongComparator
which defines an order that
is the combination of the individual SongComparator
s in
the specified ArrayList
.
The order defined by the returned SongComparator
is
determined by applying the SongComparator
s in the
specified ArrayList
, in the order in which they appear in
the specified ArrayList
. This process is repeated until
one of the SongComparators
determines that a
Song
occurs before or after the other in the order it
defines, or until all the SongComparator
in the specified
ArrayList
have been tried without one determining that one
of the Song
s occurs before or after the other in the
orders they define.
null
elements contained in the specified
ArrayList
are not included in the new
SongComparator
. Subsequent changes to the specified
ArrayList
do not affect the SongComparator
returned by this method.
subComparators
- An ArrayList
containing the individual
SongComparator
s which are to be part of the
returned SongComparator
.
SongComparator
which is the combination of the
SongComparator
s in subComparators
.
NullPointerException
- if subComparators
is null
.public SongComparator createMultiComparator(SongComparator[] subComparators)
Creates a new SongComparator
which defines an order that
is the combination of the individual SongComparator
s in
the specified array.
The order defined by the returned SongComparator
s in the
specified array, in the order in which they appear in the specified
array. This process is repeated until one of the SongComparators
determines that a Song
occurs before or after the other in
the order it defines, or until all the SongComparator
in
the specified array have been tried without one determining that one of
the Song
s occurs before or after the other in the orders
they define.
null
elements contained in the specified array are not
included in the new SongComparator
. Subsequent changes to
the specified array do not affect the SongComparator
returned by this method.
subComparators
- An array containing the individual SongComparator
s
which are to be part of the returned SongComparator
.
SongComparator
which is the combination of the
SongComparator
in subComparators
.
NullPointerException
- if subComparators
is null
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |