org.aitools.programd.processor.aiml
Class SubstitutionProcessor

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.SubstitutionProcessor
Direct Known Subclasses:
GenderProcessor, Person2Processor, PersonProcessor

public abstract class SubstitutionProcessor
extends AIMLProcessor

Handles a substitution element.

Author:
Noel Bush

Field Summary
 
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
SubstitutionProcessor(Core coreToUse)
          Creates a new SubstitutionProcessor using the given Core.
 
Method Summary
 java.lang.String applySubstitutions(java.lang.Class<? extends Processor> processor, java.lang.String string, java.lang.String botid)
          Applies each substitution in the given map to the input.
protected  java.lang.String process(java.lang.Class<? extends Processor> processor, org.w3c.dom.Element element, TemplateParser parser)
           
 
Methods inherited from class org.aitools.programd.processor.aiml.AIMLProcessor
process, process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubstitutionProcessor

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

Parameters:
coreToUse - the Core object to use
Method Detail

process

protected java.lang.String process(java.lang.Class<? extends Processor> processor,
                                   org.w3c.dom.Element element,
                                   TemplateParser parser)
                            throws ProcessorException
Parameters:
processor - the processor that is requesting the substitution
element - the element to process
parser - the parser in use
Returns:
the result of processing the substitution element
Throws:
ProcessorException
See Also:
AIMLProcessor.process(Element, TemplateParser)

applySubstitutions

public java.lang.String applySubstitutions(java.lang.Class<? extends Processor> processor,
                                           java.lang.String string,
                                           java.lang.String botid)
Applies each substitution in the given map to the input.

Parameters:
processor - the processor whose substitutions should be applied
string - the string on which to perform the replacement
botid - the bot whose substitutions should be applied
Returns:
the input with substitutions applied