kmy.regex.util
Class ProxyRegex
java.lang.Object
|
+--kmy.regex.util.Regex
|
+--kmy.regex.util.ProxyRegex
- Direct Known Subclasses:
- CaseInsensitiveRegex, SimpleRegex
- public class ProxyRegex
- extends Regex
Method Summary |
Regex |
cloneRegex()
|
char[] |
getCharBuffer(int extHandle)
Returns external variable buffer by its buffer handle. |
int |
getExtVariableHandle(java.lang.String var)
Returns external variable buffer handle that can be used later to get or set
variable value efficiently. |
int |
getIndex(int handle)
Returns external or internal variable index using its index handle. |
int |
getMatchEnd()
After successiful search returns matching substring's final position in
the input buffer (that was set up by init method). |
int |
getMatchStart()
After successiful search returns matching substring's initial position in
the input buffer (that was set up by init method). |
int |
getVariableHandle(java.lang.String var,
boolean begin)
Returns variable index handle that can be used later to get or set
variable value efficiently. |
void |
init(char[] arr,
int off,
int len)
Prepares to match or search. |
boolean |
match()
Match the beginning of the buffer (that was set up by init method) against
this regex. |
boolean |
matchWhole()
Match the buffer (that was set up by init method) against
this regex. |
boolean |
search()
Search the buffer (that was set up by init method) for a substring that matches
this regex. |
boolean |
searchAgain()
Search the buffer (that was set up by init method) for a substring that matches
this regex. |
void |
setExtVariableBuffer(int extHandle,
char[] arr)
Assignes external variable buffer by its buffer handle. |
void |
setIndex(int handle,
int value)
Returns internal variable index using its index handle. |
void |
setRefilledBuffer(char[] buffer)
Refiller can call this method after refilling the buffer,
if buffer has been reallocated. |
void |
setRefiller(RegexRefiller refiller)
|
java.lang.String |
toString()
|
java.util.Enumeration |
variables()
Enumerates all external and internal variables in this regex. |
Methods inherited from class kmy.regex.util.Regex |
accept,
clone,
createFilePattern,
createLowerCaseRegex,
createRegex,
createRegex,
createRegex,
get,
getMatch,
getMatchString,
init,
init,
initFactory,
matches,
matches,
matchesWhole,
matchesWhole,
searchOnce,
searchOnce,
searchOnce,
searchOnce,
set,
setExtVariable,
setExtVariable,
setExtVariable,
setExtVariable,
setFactory |
Methods inherited from class java.lang.Object |
,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
regex
Regex regex
ProxyRegex
public ProxyRegex(Regex orig)
getVariableHandle
public int getVariableHandle(java.lang.String var,
boolean begin)
- Description copied from class: Regex
- Returns variable index handle that can be used later to get or set
variable value efficiently. If efficiency is not a concern, use
get and set methods instead. Every variable has two index handles -
'begin' and 'end' index handle.
- Overrides:
- getVariableHandle in class Regex
getExtVariableHandle
public int getExtVariableHandle(java.lang.String var)
- Description copied from class: Regex
- Returns external variable buffer handle that can be used later to get or set
variable value efficiently. If efficiency is not a concern, use
get and set methods instead. Only external variables have buffer
handle. This is different from index handles. For internal variables
this method returs -1.
- Overrides:
- getExtVariableHandle in class Regex
variables
public java.util.Enumeration variables()
- Description copied from class: Regex
- Enumerates all external and internal variables in this regex.
- Overrides:
- variables in class Regex
init
public void init(char[] arr,
int off,
int len)
- Description copied from class: Regex
- Prepares to match or search. Sets up an input buffer and a range of characters in it
that is to be searched or matched.
- Overrides:
- init in class Regex
searchAgain
public boolean searchAgain()
- Description copied from class: Regex
- Search the buffer (that was set up by init method) for a substring that matches
this regex. See description of this class for difference between search and match.
On success do not discard record of all other possible matches, so if this method
is called again, different way of matching can be found for already found substring
or a substring overlapping already found substring. Most often, search(),
not searchAgain() should be used.
- Overrides:
- searchAgain in class Regex
search
public boolean search()
- Description copied from class: Regex
- Search the buffer (that was set up by init method) for a substring that matches
this regex. See description of this class for difference between search and match.
All records for other possible matches withing matching substring that was found
are destroyed, so if this method is called again, search will start at the first
position after previously found substring.
- Overrides:
- search in class Regex
match
public boolean match()
- Description copied from class: Regex
- Match the beginning of the buffer (that was set up by init method) against
this regex. See description of this class for difference between search/match/matchWhole.
- Overrides:
- match in class Regex
matchWhole
public boolean matchWhole()
- Description copied from class: Regex
- Match the buffer (that was set up by init method) against
this regex. See description of this class for difference between search/match/matchWhole.
- Overrides:
- matchWhole in class Regex
getIndex
public int getIndex(int handle)
- Description copied from class: Regex
- Returns external or internal variable index using its index handle. Every variable
has two indices - 'begin' and 'end'. Use 'begin' and 'end' handles to get them.
These indices can be used to determine which part of the input buffer (set by init method)
corresponding internal variable matched. An external variable 'begin' and 'end' indices
point to its own buffer. They are assinged by setIndex and are never changed.
- Overrides:
- getIndex in class Regex
setIndex
public void setIndex(int handle,
int value)
- Description copied from class: Regex
- Returns internal variable index using its index handle. Every variable
has two indices - 'begin' and 'end'. Use 'begin' and 'end' handles to assign them.
These indices are needed to completely specify value of an external variable.
- Overrides:
- setIndex in class Regex
getCharBuffer
public char[] getCharBuffer(int extHandle)
- Description copied from class: Regex
- Returns external variable buffer by its buffer handle. If -1 is passed as a handle
the input buffer that was set up for matching (using init) is returned.
- Overrides:
- getCharBuffer in class Regex
getMatchStart
public int getMatchStart()
- Description copied from class: Regex
- After successiful search returns matching substring's initial position in
the input buffer (that was set up by init method).
- Overrides:
- getMatchStart in class Regex
getMatchEnd
public int getMatchEnd()
- Description copied from class: Regex
- After successiful search returns matching substring's final position in
the input buffer (that was set up by init method).
- Overrides:
- getMatchEnd in class Regex
setExtVariableBuffer
public void setExtVariableBuffer(int extHandle,
char[] arr)
- Description copied from class: Regex
- Assignes external variable buffer by its buffer handle.
It is needed to completely specify value of an external variable.
- Overrides:
- setExtVariableBuffer in class Regex
setRefiller
public void setRefiller(RegexRefiller refiller)
- Overrides:
- setRefiller in class Regex
setRefilledBuffer
public void setRefilledBuffer(char[] buffer)
- Description copied from class: Regex
- Refiller can call this method after refilling the buffer,
if buffer has been reallocated.
- Overrides:
- setRefilledBuffer in class Regex
cloneRegex
public Regex cloneRegex()
- Overrides:
- cloneRegex in class Regex
toString
public java.lang.String toString()
- Overrides:
- toString in class java.lang.Object