org.aitools.programd.processor.aiml
Class ConditionProcessor

java.lang.Object
  extended by org.aitools.programd.processor.Processor
      extended by org.aitools.programd.processor.aiml.AIMLProcessor
          extended by org.aitools.programd.processor.aiml.ConditionProcessor

public class ConditionProcessor
extends AIMLProcessor

Handles a condition element.

Author:
Jon Baer, Thomas Ringate, Pedro Colla, Noel Bush

Nested Class Summary
static class ConditionProcessor.ListItemType
          Different types of condition.
 
Field Summary
static java.lang.String label
          The label (as required by the registration scheme).
 
Fields inherited from class org.aitools.programd.processor.aiml.AIMLProcessor
aimlLogger, logger
 
Fields inherited from class org.aitools.programd.processor.Processor
core, EMPTY_STRING, ENABLED, ID, NAME, NAME_EQUALS, VALUE, VALUE_EQUALS
 
Constructor Summary
ConditionProcessor(Core coreToUse)
          Creates a new ConditionProcessor using the given Core.
 
Method Summary
 java.lang.String process(org.w3c.dom.Element element, TemplateParser parser)
          Processes the given element, using the given parser if needed.
 java.lang.String processListItem(TemplateParser parser, org.w3c.dom.NodeList list, ConditionProcessor.ListItemType type, java.lang.String name)
          Evaluates an <li/> element inside a <condition/>.
 
Methods inherited from class org.aitools.programd.processor.aiml.AIMLProcessor
process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

label

public static final java.lang.String label
The label (as required by the registration scheme).

See Also:
Constant Field Values
Constructor Detail

ConditionProcessor

public ConditionProcessor(Core coreToUse)
Creates a new ConditionProcessor using the given Core.

Parameters:
coreToUse - the Core object to use
Method Detail

process

public java.lang.String process(org.w3c.dom.Element element,
                                TemplateParser parser)
                         throws ProcessorException
Description copied from class: AIMLProcessor
Processes the given element, using the given parser if needed.

Specified by:
process in class AIMLProcessor
Parameters:
element - the element to process
parser - the parser that has ordered the processing
Returns:
the result of processing the element
Throws:
ProcessorException - if there is an unrecoverable problem processing the element
See Also:
AIMLProcessor.process(Element, TemplateParser)

processListItem

public java.lang.String processListItem(TemplateParser parser,
                                        org.w3c.dom.NodeList list,
                                        ConditionProcessor.ListItemType type,
                                        java.lang.String name)
                                 throws ProcessorException
Evaluates an <li/> element inside a <condition/>.

Parameters:
parser - the TemplateParser object responsible for this
list - the XML trie
type - one of NAME_VALUE, DEFAULT, VALUE_ONLY
name - the name attribute of the <li/> (if applicable)
Returns:
the result of processing this <li/>
Throws:
ProcessorException - if there is an error in processing