* @return the replaced pattern property or <code>null</code>
* @throws IllegalArgumentException if pattern matching is not available
*/
protected TokenizerProperty addPattern(TokenizerProperty patternProp) throws IllegalArgumentException {
// construct the pattern
PatternMatcher data = null;
String pattern = patternProp.getImages()[0];
try {
data = new PatternMatcher(patternProp, getParseFlags());
} catch (Throwable ex) {
throw new ExtIllegalArgumentException(ex, "Pattern matching is not available (use JDK 1.4 or above).");
}
// Register pattern. First search for existing one
for (int index = 0; index < _patterns.size(); ++index) {
PatternMatcher oldData = (PatternMatcher)_patterns.get(index);
TokenizerProperty oldProp = oldData.getProperty();
if (oldProp.getImages()[0].equals(pattern)) {
_patterns.set(index, data);
return oldProp;
}