|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.edugility.objexj.Matcher<T>
T
- the kind of Object
any input consists ofpublic class Matcher<T>
An object that matches a Pattern
against a List
of
items (the input).
Matcher
s are produced by the Pattern.matcher(List)
method. Once a Matcher
has been
produced it stores results about any match that might have
occurred.
Matcher
s are not safe for use by multiple Java
threads.
Pattern
,
Pattern.matcher(List)
,
matches()
,
lookingAt()
,
Syntax
GuideMethod Summary | |
---|---|
Object |
get(Object key)
Returns the value of the variable indexed under the supplied key, or null if no such value was ever
established. |
List<? extends T> |
getInput()
Returns the input with which this Matcher is currently
affiliated. |
Pattern<T> |
getPattern()
Returns the Pattern with which this Matcher is
currently affiliated. |
Map<?,?> |
getVariables()
Returns a non- null , unmodifiable Map
representing the variables set by this Matcher during its
execution. |
List<? extends T> |
group(int index)
Returns the capture group matched by the last match indexed under the supplied zero-based index, or null if
no such capture group was matched. |
int |
groupCount()
Returns the total number of capture groups matched by this Matcher . |
boolean |
lookingAt()
Returns true if a prefix of this Matcher 's input matches this Matcher 's affiliated
Pattern. |
boolean |
matches()
Returns true if this Matcher matches the entire
input against its affiliated
Pattern. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public final boolean matches()
true
if this Matcher
matches the entire
input against its affiliated
Pattern.
In many cases the lookingAt()
method is more
suitable.
true
if this Matcher
matches the
entire input against its affiliated Pattern; false
otherwiselookingAt()
public final boolean lookingAt()
true
if a prefix of this Matcher
's input matches this Matcher
's affiliated
Pattern.
Sometimes the matches()
method is more suitable.
true
if a prefix of this Matcher
's input matches this Matcher
's affiliated
Pattern; false
otherwisematches()
public final int groupCount()
Matcher
. Any successful match will cause this
method to return an int
greater than or equal to 1
. Group indices are numbered starting with 0
.
Matcher
; never less than 0
public final List<? extends T> group(int index)
null
if
no such capture group was matched.
index
- a zero-based number identifying a capture group; may
be any number
List
of items (a subset of the input), or null
if no such capture group was
ever identifiedpublic final Map<?,?> getVariables()
null
, unmodifiable Map
representing the variables set by this Matcher
during its
execution. Variables may be set from within a Pattern
's
parsed expression.
This method never returns null
.
null
unmodifiable Map
of
variablespublic final Object get(Object key)
null
if no such value was ever
established. Variables may be set from within a Pattern
's parsed expression.
key
- the name of the variable; may be null
but if
so then null
will be returned
null
public final Pattern<T> getPattern()
Pattern
with which this Matcher
is
currently affiliated. This method never returns null
.
null
Pattern
public final List<? extends T> getInput()
Matcher
is currently
affiliated. This method may return null
.
null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |