org.alicebot.server.core
Class Bot

java.lang.Object
  extended by org.alicebot.server.core.Bot

public class Bot
extends java.lang.Object

Describes all of the properties of a bot.

Since:
4.1.5
Author:
Noel Bush

Field Summary
protected  XMLResourceSpec chatlogSpec
          The resource spec for logs from this bot.
protected  java.lang.String PREDICATE_EMPTY_DEFAULT
          The predicate empty default.
 
Constructor Summary
Bot(java.lang.String id)
           
 
Method Summary
 void addGenderSubstitution(java.lang.String find, java.lang.String replace)
           
 void addInputSubstitution(java.lang.String find, java.lang.String replace)
           
 void addPerson2Substitution(java.lang.String find, java.lang.String replace)
           
 void addPersonSubstitution(java.lang.String find, java.lang.String replace)
           
 void addPredicateInfo(java.lang.String name, java.lang.String defaultValue, boolean returnNameWhenSet)
          Registers some information about a predicate in advance.
 void addSentenceSplitter(java.lang.String splitter)
          Adds a sentence splitter to the sentence splitters list.
 void addToFilenameMap(java.lang.String filename, Nodemapper nodemapper)
          Adds a nodemapper to the filename map.
 java.lang.String applyInputSubstitutions(java.lang.String input)
           
 XMLResourceSpec getChatlogSpec()
           
 java.util.HashMap getGenderSubstitutionsMap()
           
 java.lang.String getID()
           
 java.util.HashMap getInputSubstitutionsMap()
           
 java.util.HashMap getLoadedFilesMap()
           
 java.util.HashMap getPerson2SubstitutionsMap()
           
 java.util.HashMap getPersonSubstitutionsMap()
           
 java.util.Map getPredicateCache()
          Returns the predicate cache.
 java.util.HashMap getPredicatesInfo()
          Returns the predicates info map.
 java.lang.String getPropertyValue(java.lang.String name)
          Retrieves the value of a named bot property.
 java.util.ArrayList getSentenceSplitters()
           
 java.util.Map predicatesFor(java.lang.String userid)
          Returns the map of predicates for a userid if it is cached, or a new map if it is not cached.
 java.util.ArrayList sentenceSplit(java.lang.String input)
           
 void setPropertyValue(java.lang.String name, java.lang.String value)
          Sets the value of a bot property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREDICATE_EMPTY_DEFAULT

protected java.lang.String PREDICATE_EMPTY_DEFAULT
The predicate empty default.


chatlogSpec

protected XMLResourceSpec chatlogSpec
The resource spec for logs from this bot.

Constructor Detail

Bot

public Bot(java.lang.String id)
Method Detail

getID

public java.lang.String getID()

getLoadedFilesMap

public java.util.HashMap getLoadedFilesMap()

addToFilenameMap

public void addToFilenameMap(java.lang.String filename,
                             Nodemapper nodemapper)
Adds a nodemapper to the filename map.

Parameters:
filename - the filename
nodemapper - the mapper for the node to add

getPropertyValue

public java.lang.String getPropertyValue(java.lang.String name)
Retrieves the value of a named bot property.

Parameters:
property - the name of the bot property to get
Returns:
the value of the bot property

setPropertyValue

public void setPropertyValue(java.lang.String name,
                             java.lang.String value)
Sets the value of a bot property.

Parameters:
property - the name of the bot predicate to set

addPredicateInfo

public void addPredicateInfo(java.lang.String name,
                             java.lang.String defaultValue,
                             boolean returnNameWhenSet)
Registers some information about a predicate in advance. Not required; just used when it is necessary to specify a default value for a predicate and/or specify its type as return-name-when-set.

Parameters:
name - the name of the predicate
defaultValue - the default value (if any) for the predicate
returnNameWhenSet - whether the predicate should return its name when set
botid - the bot id for whom to register the predicate this way (not yet used)

getPredicatesInfo

public java.util.HashMap getPredicatesInfo()
Returns the predicates info map.

Returns:
the predicates info map

getPredicateCache

public java.util.Map getPredicateCache()
Returns the predicate cache.

Returns:
the predicate cache

predicatesFor

public java.util.Map predicatesFor(java.lang.String userid)
Returns the map of predicates for a userid if it is cached, or a new map if it is not cached.

Parameters:
userid -

addInputSubstitution

public void addInputSubstitution(java.lang.String find,
                                 java.lang.String replace)

addGenderSubstitution

public void addGenderSubstitution(java.lang.String find,
                                  java.lang.String replace)

addPersonSubstitution

public void addPersonSubstitution(java.lang.String find,
                                  java.lang.String replace)

addPerson2Substitution

public void addPerson2Substitution(java.lang.String find,
                                   java.lang.String replace)

addSentenceSplitter

public void addSentenceSplitter(java.lang.String splitter)
Adds a sentence splitter to the sentence splitters list.

Parameters:
splitter - the string on which to divide sentences

getInputSubstitutionsMap

public java.util.HashMap getInputSubstitutionsMap()

getGenderSubstitutionsMap

public java.util.HashMap getGenderSubstitutionsMap()

getPersonSubstitutionsMap

public java.util.HashMap getPersonSubstitutionsMap()

getPerson2SubstitutionsMap

public java.util.HashMap getPerson2SubstitutionsMap()

getSentenceSplitters

public java.util.ArrayList getSentenceSplitters()

sentenceSplit

public java.util.ArrayList sentenceSplit(java.lang.String input)

applyInputSubstitutions

public java.lang.String applyInputSubstitutions(java.lang.String input)

getChatlogSpec

public XMLResourceSpec getChatlogSpec()