org.alicebot.server.core.parser
Class TemplateParser

java.lang.Object
  extended by org.alicebot.server.core.parser.GenericParser
      extended by org.alicebot.server.core.parser.TemplateParser

public class TemplateParser
extends GenericParser

TemplateParser is still a primitive class, implementing not a "real" XML parser, but just enough (hopefully) to get the job done.


Field Summary
 
Fields inherited from class org.alicebot.server.core.parser.GenericParser
ATOMIC_MARKER_END, CLOSE_MARKER_START, COLON, COMMA, EMPTY_STRING, INDEX, NONATOMIC_MARKER_END, OPEN_MARKER_START, processorRegistry
 
Constructor Summary
TemplateParser(java.lang.String input, java.lang.String userid, java.lang.String botid)
          Initializes an TemplateParser.
 
Method Summary
 void addInput(java.lang.String input)
          Adds an input to the inputs list (for avoiding infinite loops).
 java.lang.String getBotID()
          Returns the botid.
 java.util.ArrayList getInputs()
          Returns the input that matched the pattern associated with this template.
 java.util.ArrayList getInputStars()
          Returns the values captured from the input path by wildcards in the pattern.
 java.util.ArrayList getThatStars()
          Returns the the values captured from the input path by wildcards in the that.
 java.util.ArrayList getTopicStars()
          Returns the values captured from the input path by wildcards in the topic name.
 java.lang.String getUserID()
          Returns the userid.
 java.lang.String processTag(int level, XMLNode tag)
          Processes the AIML within and including a given AIML element.
 void setInputStars(java.util.ArrayList stars)
          Sets the inputStars list.
 void setThatStars(java.util.ArrayList stars)
          Sets the thatStars list.
 void setTopicStars(java.util.ArrayList stars)
          Sets the topicStars Vector.
 
Methods inherited from class org.alicebot.server.core.parser.GenericParser
evaluate, formatTag, getNode, getValid1dIndex, getValid2dIndex, nodeCount, processResponse, shortcutTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateParser

public TemplateParser(java.lang.String input,
                      java.lang.String userid,
                      java.lang.String botid)
               throws TemplateParserException
Initializes an TemplateParser. The input is a required parameter!

Parameters:
input - the input that matched the pattern associated with this template (helps to avoid endless loops)
Throws:
TemplateParserException - if the input is null
Method Detail

processTag

public java.lang.String processTag(int level,
                                   XMLNode tag)
                            throws ProcessorException
Processes the AIML within and including a given AIML element.

Overrides:
processTag in class GenericParser
Parameters:
level - the current level in the XML trie
tag - the tag being evaluated
Returns:
the result of processing the tag
Throws:
AIMLProcessorException - if the AIML cannot be processed
ProcessorException - if the content cannot be processed

addInput

public void addInput(java.lang.String input)
Adds an input to the inputs list (for avoiding infinite loops).

Parameters:
input - the input to add

getInputs

public java.util.ArrayList getInputs()
Returns the input that matched the pattern associated with this template.

Returns:
the input that matched the pattern associated with this template

getInputStars

public java.util.ArrayList getInputStars()
Returns the values captured from the input path by wildcards in the pattern.

Returns:
the values captured from the input path by wildcards in the pattern

getThatStars

public java.util.ArrayList getThatStars()
Returns the the values captured from the input path by wildcards in the that.

Returns:
the values captured from the input path by wildcards in the that

getTopicStars

public java.util.ArrayList getTopicStars()
Returns the values captured from the input path by wildcards in the topic name.

Returns:
the values captured from the input path by wildcards in the topic name

setInputStars

public void setInputStars(java.util.ArrayList stars)
Sets the inputStars list.

Parameters:
values - captured from the input path by wildcards in the pattern

setThatStars

public void setThatStars(java.util.ArrayList stars)
Sets the thatStars list.

Parameters:
values - captured from the input path by wildcards in the that

setTopicStars

public void setTopicStars(java.util.ArrayList stars)
Sets the topicStars Vector.

Parameters:
values - captured from the input path by wildcards in the topic name

getUserID

public java.lang.String getUserID()
Returns the userid.

Returns:
the userid

getBotID

public java.lang.String getBotID()
Returns the botid.

Returns:
the botid