Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.memoire.re
Class REMatchEnumeration  view REMatchEnumeration download REMatchEnumeration.java

java.lang.Object
  extended bycom.memoire.re.REMatchEnumeration
All Implemented Interfaces:
java.util.Enumeration

public class REMatchEnumeration
extends java.lang.Object
implements java.util.Enumeration

An REMatchEnumeration enumerates regular expression matches over a given input text. You obtain a reference to an enumeration using the 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 an 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.


Field Summary
private  java.lang.StringBuffer m_buffer
           
private  int m_eflags
           
private  RE m_expr
           
private  int m_index
           
private  RECharIndexed m_input
           
private  REMatch m_match
           
private  int m_more
           
private static int MAYBE
           
private static int NO
           
private static int YES
           
 
Constructor Summary
(package private) REMatchEnumeration(RE expr, RECharIndexed input, int index, int eflags)
           
 
Method Summary
 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(java.lang.StringBuffer f_buffer)
          Returns true if there are more matches in the input text.
 java.lang.Object nextElement()
          Returns the next match in the input text.
 REMatch nextMatch()
          Returns the next match in the input text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

YES

private static final int YES
See Also:
Constant Field Values

MAYBE

private static final int MAYBE
See Also:
Constant Field Values

NO

private static final int NO
See Also:
Constant Field Values

m_more

private int m_more

m_match

private REMatch m_match

m_expr

private RE m_expr

m_input

private RECharIndexed m_input

m_index

private int m_index

m_eflags

private int m_eflags

m_buffer

private java.lang.StringBuffer m_buffer
Constructor Detail

REMatchEnumeration

REMatchEnumeration(RE expr,
                   RECharIndexed input,
                   int index,
                   int eflags)
Method Detail

hasMoreElements

public boolean hasMoreElements()
Returns true if there are more matches in the input text.

Specified by:
hasMoreElements in interface java.util.Enumeration

hasMoreMatches

public boolean hasMoreMatches()
Returns true if there are more matches in the input text.


hasMoreMatches

public boolean hasMoreMatches(java.lang.StringBuffer f_buffer)
Returns true if there are more matches in the input text. Saves the text leading up to the match (or to the end of the input) in the specified buffer.


nextElement

public java.lang.Object nextElement()
Returns the next match in the input text.

Specified by:
nextElement in interface java.util.Enumeration

nextMatch

public REMatch nextMatch()
Returns the next match in the input text. This method is provided for convenience to avoid having to explicitly cast the return value to class REMatch.