|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectcomp202.fall2007.a5.filter.StringMatchType
public abstract class StringMatchType
A StringMatchType
object defines a way to determine whether
two String
s match. It is used mostly by
SongFilter
s who define conditions based on text attributes of
Song
s, such as the artist name or album title, to determine
whether a Song
matches the conditions they define.
Field Summary | |
---|---|
static StringMatchType |
CONTAINS
Implements String matching as substring. |
static StringMatchType |
EQUALS
Implements String matching as comparison for equality. |
Method Summary | |
---|---|
abstract boolean |
match(String left,
String right,
boolean ignorecase)
Determines whether the first specified String matches the
second specified String according to the matching
algorithm implemented by this StringMatchType . |
String |
toString()
Returns a String representation of this
StringMatchType which describes the type of matching it
represents. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final StringMatchType EQUALS
Implements String
matching as comparison for equality.
Used in the construction of SongFilter
s to indicate that
equality matching should be used by a SongFilter
. In
other words, if a SongFilter
that defines a condition
based on a text attribute of Song
s uses this
StringMatchType
, it accepts the Song
if
the value of the Song
's attribute is equal to the filter
value.
public static final StringMatchType CONTAINS
Implements String
matching as substring. Used in the
construction of SongFilter
s to indicate that substring
matching should be used by a SongFilter
. In other words,
if a SongFilter
that defines a condition based on a text
attribute of Song
s uses this StringMatchType
,
it accepts the Song
if the value of the Song
's
attribute contains the filter value as a substring.
Method Detail |
---|
public String toString()
Returns a String
representation of this
StringMatchType
which describes the type of matching it
represents.
toString
in class Object
String
representation of this
StringMatchType
.public abstract boolean match(String left, String right, boolean ignorecase)
Determines whether the first specified String
matches the
second specified String
according to the matching
algorithm implemented by this StringMatchType
.
This method is called internally by methods defined in the
SongFilter
class, and does not need to be called by
classes which use SongFilter
s.
left
- The first String
right
- The second String
ignorecase
- true
if the alphabetic case of letters should
be ignored when deciding whether left
and
right
match, false
otherwise.
true
if left
matches
right
according to the type of matching algorithm
implemented by this StringMatchType
,
false
otherwise.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |