|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.aitools.programd.util.PatternArbiter
public class PatternArbiter
Provides utility methods for pattern-oriented tasks.
| Constructor Summary | |
|---|---|
PatternArbiter()
|
|
| Method Summary | |
|---|---|
static void |
checkAIMLPattern(String pattern)
Determines whether a given string is a valid AIML pattern. |
static Pattern |
compile(String pattern,
boolean ignoreCase)
Translates the given AIML pattern to a regular expression and compiles it into a Pattern object. |
static String |
genericallyNormalize(String string)
Applies a generic set of normalizations to an input, to prepare it for pattern matching. |
static void |
main(String[] args)
For testing. |
static boolean |
matches(String literal,
String pattern,
boolean ignoreCase)
Decides whether a given pattern matches a given literal, in an isolated context, according to the AIML pattern-matching specification. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PatternArbiter()
| Method Detail |
|---|
public static String genericallyNormalize(String string)
string - the input to normalize
public static Pattern compile(String pattern,
boolean ignoreCase)
throws NotAnAIMLPatternException
pattern - the pattern to compileignoreCase - whether to ignore case in matching
NotAnAIMLPatternException - if the pattern is not a valid AIML
pattern (conditioned by ignoreCase
public static boolean matches(String literal,
String pattern,
boolean ignoreCase)
throws NotAnAIMLPatternException
literal - the literal string to checkpattern - the pattern to try to match against itignoreCase - whether or not to ignore case
true if pattern matches
literal,false if not
NotAnAIMLPatternException - if the pattern is not a valid AIML
pattern (conditioned by ignoreCase
public static void checkAIMLPattern(String pattern)
throws NotAnAIMLPatternException
pattern - the string to check
NotAnAIMLPatternException - with a helpful message if the pattern
is not validpublic static void main(String[] args)
args - not used
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||