public class REMatchEnumeration extends Object implements Enumeration, Serializable
getMatchEnumeration()
methods on an instance of
RE.
REMatchEnumeration does lazy computation; that is, it will not
search for a match until it needs to. If you'd rather just get all
the matches at once in a big array, use the
getAllMatches()
methods on RE. However, using an
enumeration can help speed performance when the entire text does
not need to be searched immediately.
The enumerated type is especially useful when searching on a Reader
or InputStream, because the InputStream read position cannot be
guaranteed after calling getMatch()
(see the
description of that method for an explanation of why). Enumeration
also saves a lot of overhead required when calling
getMatch()
multiple times.
Modifier and Type | Field and Description |
---|---|
private int |
eflags |
private RE |
expr |
private int |
index |
private CharIndexed |
input |
private REMatch |
match |
private static int |
MAYBE |
private int |
more |
private static int |
NO |
private static int |
YES |
Constructor and Description |
---|
REMatchEnumeration(RE expr,
CharIndexed input,
int index,
int eflags) |
Modifier and Type | Method and Description |
---|---|
boolean |
hasMoreElements()
Returns true if there are more matches in the input text.
|
boolean |
hasMoreMatches()
Returns true if there are more matches in the input text.
|
boolean |
hasMoreMatches(StringBuffer buffer)
Returns true if there are more matches in the input text.
|
Object |
nextElement()
Returns the next match in the input text.
|
REMatch |
nextMatch()
Returns the next match in the input text.
|
private static final int YES
private static final int MAYBE
private static final int NO
private int more
private CharIndexed input
private int eflags
private int index
REMatchEnumeration(RE expr, CharIndexed input, int index, int eflags)
public boolean hasMoreElements()
hasMoreElements
in interface Enumeration
public boolean hasMoreMatches()
public boolean hasMoreMatches(StringBuffer buffer)
public Object nextElement() throws NoSuchElementException
nextElement
in interface Enumeration
NoSuchElementException
public REMatch nextMatch() throws NoSuchElementException
NoSuchElementException
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses