|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectcomp202.fall2007.a5.filter.FilterFactory
public class FilterFactory
A FilterFactory
provides methods to create
SongFilter
s that define various conditions based on the
attributes of Song
s, or on the conditions defined by other
SongFilter
s.
Constructor Summary | |
---|---|
FilterFactory()
Creates a new FilterFactory . |
Method Summary | |
---|---|
SongFilter |
createAlbumFilter(String albumTitle,
StringMatchType matchType)
Creates a new SongFilter which accepts all
Song s whose album attribute matches the specified
String , using a match type defined by the specified
StringMatchType . |
SongFilter |
createAndFilter(java.util.ArrayList<SongFilter> subFilters)
Creates a new SongFilter object which accepts a given
Song if and only if all SongFilter s in the
specified ArrayList accept the given Song . |
SongFilter |
createAndFilter(SongFilter[] subFilters)
Creates a new SongFilter object which accepts a given
Song if and only if all SongFilter s in the
specified array accept the given Song . |
SongFilter |
createArtistFilter(String artistName,
StringMatchType matchType)
Creates a new SongFilter which accepts all
Song s whose artist attribute matches the specified
String , using a match type defined by the specified
StringMatchType . |
SongFilter |
createDiscFilter(int discNumber,
NumberMatchType matchType)
Creates a new SongFilter which accepts all
Song s whose disc attribute matches the specified integer,
using a match type defined by the specified NumberMatchType . |
SongFilter |
createEverythingFilter()
Creates a new SongFilter which accepts every
Song . |
SongFilter |
createLengthFilter(int length,
NumberMatchType matchType)
Creates a new SongFilter which accepts all
Song s whose length attribute matches the specified
String , using a match type defined by the specified
NumberMatchType . |
SongFilter |
createNotFilter(SongFilter subFilter)
Creates a new SongFilter which is the negation of the
specified SongFilter ; that is, if the specified
SongFilter accepts a Song , the returned
SongFilter rejects it, and vice-versa. |
SongFilter |
createNothingFilter()
Creates a new SongFilter which rejects every
Song . |
SongFilter |
createOrFilter(java.util.ArrayList<SongFilter> subFilters)
Creates a new SongFilter object which accepts a given
Song if and only if at least one of the
SongFilter s in the specified ArrayList
accepts the given Song . |
SongFilter |
createOrFilter(SongFilter[] subFilters)
Creates a new SongFilter object which accepts a given
Song if and only if at least one of the
SongFilter s in the specified array accepts the given
Song . |
SongFilter |
createPathFilter(java.io.File songPath)
Creates a new SongFilter which accepts all
Song s whose path attribute is equal to the specified
File , as defined by the equality of File
objects. |
SongFilter |
createTitleFilter(String songTitle,
StringMatchType matchType)
Creates a new SongFilter which accepts all
Song s whose title attribute matches the specified
String , using a match type defined by the specified
StringMatchType . |
SongFilter |
createTrackFilter(int trackNumber,
NumberMatchType matchType)
Creates a new SongFilter which accepts all
Song s whose track number attribute matches the specified
integer, using a match type defined by the specified
NumberMatchType . |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FilterFactory()
FilterFactory
.
Method Detail |
---|
public SongFilter createAlbumFilter(String albumTitle, StringMatchType matchType)
Creates a new SongFilter
which accepts all
Song
s whose album attribute matches the specified
String
, using a match type defined by the specified
StringMatchType
.
albumTitle
- The album title used in the condition defined by the returned
SongFilter
.matchType
- The type of comparison used by the returned
SongFilter
to determine whether a
Song
's album attribute matches
albumTitle
. The comparison is case-INsensitive.
SongFilter
which accepts all
Song
s whose album attribute matches
albumTitle
, according to the type of comparison
defined by matchType
.public SongFilter createArtistFilter(String artistName, StringMatchType matchType)
Creates a new SongFilter
which accepts all
Song
s whose artist attribute matches the specified
String
, using a match type defined by the specified
StringMatchType
.
artistName
- The artist name used in the condition defined by the returned
SongFilter
.matchType
- The type of comparison used by the returned
SongFilter
to determine whether a
Song
's artist attribute matches
artistTitle
. The comparison is case-INsensitive.
SongFilter
which accepts all
Song
s whose artist attribute matches
albumTitle
, according to the type of comparison
defined by matchType
.public SongFilter createTitleFilter(String songTitle, StringMatchType matchType)
Creates a new SongFilter
which accepts all
Song
s whose title attribute matches the specified
String
, using a match type defined by the specified
StringMatchType
.
songTitle
- The song title used in the condition defined by the returned
SongFilter
.matchType
- The type of comparison used by the returned
SongFilter
to determine whether a
Song
's title attribute matches
artistTitle
. The comparison is case-INsensitive.
SongFilter
which accepts all
Song
s whose title attribute matches
albumTitle
, according to the type of comparison
defined by matchType
.public SongFilter createPathFilter(java.io.File songPath)
Creates a new SongFilter
which accepts all
Song
s whose path attribute is equal to the specified
File
, as defined by the equality of File
objects.
songPath
- The path used in the condition defined by the returned
SongFilter
.
SongFilter
which accepts all
Song
s whose path attribute is equal to
songPath
.public SongFilter createLengthFilter(int length, NumberMatchType matchType)
Creates a new SongFilter
which accepts all
Song
s whose length attribute matches the specified
String
, using a match type defined by the specified
NumberMatchType
.
length
- The length value used in the condition defined by the returned
SongFilter
.matchType
- The type of comparison used by the returned
SongFilter
to determine whether a
Song
's length matches length
.
SongFilter
which accepts all
Song
s whose length attribute matches
length
, according to the type of comparison
defined by matchType
.public SongFilter createDiscFilter(int discNumber, NumberMatchType matchType)
Creates a new SongFilter
which accepts all
Song
s whose disc attribute matches the specified integer,
using a match type defined by the specified NumberMatchType
.
discNumber
- The disc number used in the condition defined by the returned
SongFilter
.matchType
- The type of comparison used by the returned
SongFilter
to determine whether a
Song
's disc number matches
discNumber
.
SongFilter
which accepts all
Song
s whose disc number attribute matches
discNumber
, according to the type of comparison
defined by matchType
.public SongFilter createTrackFilter(int trackNumber, NumberMatchType matchType)
Creates a new SongFilter
which accepts all
Song
s whose track number attribute matches the specified
integer, using a match type defined by the specified
NumberMatchType
.
trackNumber
- The track number used in the condition defined by the returned
SongFilter
.matchType
- The type of comparison used by the returned
SongFilter
to determine whether a
Song
's track number matches
discNumber
.
SongFilter
which accepts all
Song
s whose track number attribute matches
trackNumber
, according to the type of comparison
defined by matchType
.public SongFilter createEverythingFilter()
Creates a new SongFilter
which accepts every
Song
. That is, the returned SongFilter
's
accept()
method always returns true
.
SongFilter
which accepts every
Song
.public SongFilter createNothingFilter()
Creates a new SongFilter
which rejects every
Song
. That is, the returned SongFilter
's
accept()
method always returns false
.
SongFilter
which rejects every
Song
.public SongFilter createAndFilter(java.util.ArrayList<SongFilter> subFilters)
Creates a new SongFilter
object which accepts a given
Song
if and only if all SongFilter
s in the
specified ArrayList
accept the given Song
.
Subsequent changes to the specified ArrayList
do not
affect the state of the SongFilter
that this method
creates and returns.
subFilters
- An ArrayList
of SongFilters
; to
be accepted by the newly-created SongFilter
, a
Song
must be accepted by all
SongFilter
s in this ArrayList
.
SongFilter
which accepts a given
Song
if and only if all SongFilters
in subFilters
accept the given Song
.public SongFilter createAndFilter(SongFilter[] subFilters)
Creates a new SongFilter
object which accepts a given
Song
if and only if all SongFilter
s in the
specified array accept the given Song
.
Subsequent changes to the specified array do not affect the state of the
SongFilter
that this method creates and returns.
subFilters
- An array of SongFilters
; to be accepted by the
newly-created SongFilter
, a Song
must be accepted by all SongFilter
s in this
array.
SongFilter
which accepts a given
Song
if and only if all SongFilters
in subFilters
accept the given Song
.public SongFilter createOrFilter(java.util.ArrayList<SongFilter> subFilters)
Creates a new SongFilter
object which accepts a given
Song
if and only if at least one of the
SongFilter
s in the specified ArrayList
accepts the given Song
.
Subsequent changes to the specified ArrayList
do not
affect the state of the SongFilter
that this method
creates and returns.
subFilters
- An ArrayList
of SongFilters
; to
be accepted by the newly-created SongFilter
, a
Song
must be accepted by at least one
SongFilter
in this ArrayList
.
SongFilter
which accepts a given
Song
if and only if at least one
SongFilter
in subFilters
accepts
the given Song
.public SongFilter createOrFilter(SongFilter[] subFilters)
Creates a new SongFilter
object which accepts a given
Song
if and only if at least one of the
SongFilter
s in the specified array accepts the given
Song
.
Subsequent changes to the specified array do not affect the state of the
SongFilter
that this method creates and returns.
subFilters
- An array of SongFilters
; to be accepted by the
newly-created SongFilter
, a Song
must be accepted by at least one SongFilter
s
in this array.
SongFilter
which accepts a given
Song
if and only if at least one
SongFilter
in subFilters
accepts
the given Song
.public SongFilter createNotFilter(SongFilter subFilter)
Creates a new SongFilter
which is the negation of the
specified SongFilter
; that is, if the specified
SongFilter
accepts a Song
, the returned
SongFilter
rejects it, and vice-versa.
subFilter
- A SongFilter
.
SongFilter
which accepts all
Song
s rejected by subFilter
, and
vice-versa.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |