org.alicebot.server.core.util
Class PatternArbiter

java.lang.Object
  extended by org.alicebot.server.core.util.PatternArbiter

public class PatternArbiter
extends java.lang.Object

Provides utility methods for pattern-oriented tasks.

Since:
4.1.3
Author:
Noel Bush

Constructor Summary
PatternArbiter()
           
 
Method Summary
static void checkAIMLPattern(java.lang.String pattern, boolean ignoreCase)
          Determines whether a given string is a valid AIML pattern.
static void main(java.lang.String[] args)
          For testing.
static boolean matches(java.lang.String literal, java.lang.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

PatternArbiter

public PatternArbiter()
Method Detail

matches

public static boolean matches(java.lang.String literal,
                              java.lang.String pattern,
                              boolean ignoreCase)
                       throws NotAnAIMLPatternException
Decides whether a given pattern matches a given literal, in an isolated context, according to the AIML pattern-matching specification.

Parameters:
literal - the literal string to check
pattern - the pattern to try to match against it
Returns:
true if pattern matches literal, false if not
Throws:
NotAnAIMLPatternException - if the pattern is not a valid AIML pattern (conditioned by ignoreCase

checkAIMLPattern

public static void checkAIMLPattern(java.lang.String pattern,
                                    boolean ignoreCase)
                             throws NotAnAIMLPatternException
Determines whether a given string is a valid AIML pattern. Conditioned by ignoreCase.

Parameters:
pattern - the string to check
ignoreCase - whether to ignore case
Throws:
NotAnAIMLPatternException - with a helpful message if the pattern is not valid

main

public static void main(java.lang.String[] args)
For testing.