org.aitools.programd.test.aiml
Class MatchChecker

java.lang.Object
  extended by org.aitools.programd.test.aiml.Checker
      extended by org.aitools.programd.test.aiml.MatchChecker

public class MatchChecker
extends Checker

Tests whether a given input matches a regular expression.

Author:
Noel Bush

Field Summary
private static java.lang.String EMPTY_STRING
           
private  java.util.regex.Matcher matcher
           
 
Fields inherited from class org.aitools.programd.test.aiml.Checker
TAG_ALERT_KEYWORDS, TAG_EXPECTED_ANSWER, TAG_EXPECTED_KEYWORDS, TAG_EXPECTED_LENGTH, TAG_EXPECTED_MATCH
 
Constructor Summary
MatchChecker(java.lang.String pattern)
          Creates a new MatchChecker with the given regular expression.
 
Method Summary
 java.lang.String getContent()
           
 java.lang.String getTagName()
           
 boolean test(java.lang.String input)
          Tests whether the given input matches the expected answer.
 
Methods inherited from class org.aitools.programd.test.aiml.Checker
create
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

matcher

private java.util.regex.Matcher matcher

EMPTY_STRING

private static final java.lang.String EMPTY_STRING
See Also:
Constant Field Values
Constructor Detail

MatchChecker

public MatchChecker(java.lang.String pattern)
Creates a new MatchChecker with the given regular expression.

Parameters:
pattern - the regular expression
Method Detail

test

public boolean test(java.lang.String input)
Tests whether the given input matches the expected answer.

Specified by:
test in class Checker
Parameters:
input - the input to test
Returns:
whether the given input matches the expected answer
See Also:
Checker.test(java.lang.String)

getContent

public java.lang.String getContent()
Specified by:
getContent in class Checker
Returns:
the textual content of the checker
See Also:
Checker.getContent()

getTagName

public java.lang.String getTagName()
Specified by:
getTagName in class Checker
Returns:
the tag name that the checker uses
See Also:
Checker.getTagName()