|
|||||||||
| Home >> All >> org >> apache >> oro >> [ text overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.oro.text
Interface PatternCache

- All Known Implementing Classes:
- GenericPatternCache
- public interface PatternCache
An interface defining the basic functions of a regular expression cache.
A PatternCache is an object that takes care of compiling, storing, and retrieving regular expressions so that the programmer does not have to explicitly manage these operation himself. The main benefit derived is the ease of use from only having to express regular expressions by their String representations.
- Since:
- 1.0
- Version:
- @version@
| Method Summary | |
org.apache.oro.text.regex.Pattern |
addPattern(java.lang.String expression)
Adds a pattern to the cache and returns the compiled pattern. |
org.apache.oro.text.regex.Pattern |
addPattern(java.lang.String expression,
int options)
Adds a pattern to the cache and returns the compiled pattern. |
int |
capacity()
Returns the maximum number of patterns that can be cached at one time. |
org.apache.oro.text.regex.Pattern |
getPattern(java.lang.String expression)
This method fetches a pattern from the cache. |
org.apache.oro.text.regex.Pattern |
getPattern(java.lang.String expression,
int options)
This method fetches a pattern from the cache. |
int |
size()
Returns the number of elements in the cache, not to be confused with the capacity() 55 which returns the number
of elements that can be held in the cache at one time. |
| Method Detail |
addPattern
public org.apache.oro.text.regex.Pattern addPattern(java.lang.String expression) throws org.apache.oro.text.regex.MalformedPatternException
- Adds a pattern to the cache and returns the compiled pattern. This
method is in principle almost identical to
getPattern(String)55 except for the fact that it throws a MalformedPatternException if an expression cannot be compiled.addPattern() is meant to be used when you expressly intend to add an expression to a cache and is useful for front-loading a cache with expressions before use. If the expression added does not already exist in the cache, it is compiled, added to the cache, and returned. If the compiled expression is already in the cache, it is simply returned.
The expected behavior of this method should be to start replacing patterns in the cache only after the cache has been filled to capacity.
addPattern
public org.apache.oro.text.regex.Pattern addPattern(java.lang.String expression, int options) throws org.apache.oro.text.regex.MalformedPatternException
- Adds a pattern to the cache and returns the compiled pattern. This
method is in principle almost identical to
getPattern(String)55 except for the fact that it throws a MalformedPatternException if an expression cannot be compiled.addPattern() is meant to be used when you expressly intend to add an expression to the cache and is useful for front-loading a cache with expressions before use. If the expression added does not already exist in the cache, it is compiled, added to the cache, and returned. If the compiled expression is already in the cache, it is simply returned.
The expected behavior of this method should be to start replacing patterns in the cache only after the cache has been filled to capacity.
getPattern
public org.apache.oro.text.regex.Pattern getPattern(java.lang.String expression) throws MalformedCachePatternException
- This method fetches a pattern from the cache. It is nearly identical
to addPattern() 55 except that it doesn't
throw a MalformedPatternException. If the pattern is not in the
cache, it is compiled, placed in the cache, and returned. If
the pattern cannot be compiled successfully, the implementation must
throw an exception derived from MalformedCachePatternException.
Note that this exception is derived from RuntimeException, which means
you are NOT forced to catch it by the compiler. Please refer to
MalformedCachePatternException for a discussion of when you
should and shouldn't catch this exception.
getPattern
public org.apache.oro.text.regex.Pattern getPattern(java.lang.String expression, int options) throws MalformedCachePatternException
- This method fetches a pattern from the cache. It is nearly identical
to addPattern() 55 except that it doesn't
throw a MalformedPatternException. If the pattern is not in the
cache, it is compiled, placed in the cache, and returned. If
the pattern cannot be compiled successfully, it
throws a MalformedCachePatternException.
Note that this exception is derived from RuntimeException, which means
you are NOT forced to catch it by the compiler. Please refer to
MalformedCachePatternException for a discussion of when you
should and shouldn't catch this exception.
size
public int size()
- Returns the number of elements in the cache, not to be confused with
the
capacity()55 which returns the number of elements that can be held in the cache at one time.
capacity
public int capacity()
- Returns the maximum number of patterns that can be cached at one time.
|
|||||||||
| Home >> All >> org >> apache >> oro >> [ text overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC