gov.llnl.babel.symbols
Class RegexMatch

java.lang.Object
  |
  +--gov.llnl.babel.symbols.RegexMatch

public class RegexMatch
extends java.lang.Object

Provide regular expression matching for SymbolID against regular expressions if the java.util.regex package is available. This class uses reflection to avoid a compile time or runtime dependence on java.util.regex.


Constructor Summary
RegexMatch(java.lang.String regex)
          Create a regular expression matching object.
 
Method Summary
static boolean hasRegex()
          Return true iff the current runtime system has regular expression support.
 boolean match(SymbolID id)
          Return true if the SymbolID matches the compiled regular expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexMatch

public RegexMatch(java.lang.String regex)
           throws RegexUnsupportedException,
                  BadRegexException
Create a regular expression matching object.

Parameters:
regex - a regular expression to be compiled.
Throws:
RegexUnsupportedException - this exception indicates that the runtime environment lacks the necessary java.util.regex package.
BadRegexException - this exception indicates that the regular expression had a syntax error. The message tries to indicate where the error occured.
Method Detail

hasRegex

public static boolean hasRegex()
Return true iff the current runtime system has regular expression support.


match

public boolean match(SymbolID id)
Return true if the SymbolID matches the compiled regular expression.

Parameters:
id - the symbol that will be compared with the regular expression.
Returns:
true indicates that the SymbolID matches the regular expression.