org.alicebot.server.core
Class Graphmaster

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

public class Graphmaster
extends java.lang.Object

The Graphmaster is the "brain" of an Alicebot. It consists of a collection of nodes called Nodemappers. These Nodemappers map the branches from each node. The branches are either single words or wildcards.

The root of the Graphmaster is a Nodemapper with many branches, one for each of the first words of all the patterns (40,000 in the case of the A.L.I.C.E. brain). The number of leaf nodes in the graph is equal to the number of categories, and each leaf node contains the <template> tag.

Version:
4.1.5
Author:
Richard Wallace, Jon Baer, Thomas Ringate/Pedro Colla, Noel Bush

Field Summary
static java.lang.String ACTIVATIONS
          Activations marker.
static java.lang.String ASTERISK
          The * wildcard.
static java.lang.String BOTID
          A botid marker.
static java.lang.String BUILD
          Build Number of this package (internal regression test control).
static java.lang.String[] COPYRIGHT
          Copyright notice.
static java.lang.String FILENAME
          A filename marker.
static java.lang.String PATH_SEPARATOR
          A path separator.
protected static int RESPONSE_TIMEOUT
          The response timeout.
static java.lang.String TEMPLATE
          A template marker.
static java.lang.String THAT
          A that marker.
static java.lang.String TOPIC
          A topic marker.
static java.lang.String UNDERSCORE
          The _ wildcard.
static java.lang.String VERSION
          Version of this package.
 
Method Summary
static void activatedNode(Nodemapper nodemapper)
          Adds a given Nodemapper to the set of activated nodes.
static Nodemapper add(java.lang.String pattern, java.lang.String that, java.lang.String topic, java.lang.String botid)
          Adds a new pattern-that-topic path to the Graphmaster root.
static void checkpoint()
          Sends new targeting data to org.alicebot.server.core.util.TargetMaster.
static int getTotalCategories()
          Returns the number of categories presently loaded.
static java.lang.String getWorkingDirectory()
          Returns the working directory.
static int incrementTotalCategories()
          Increments the total categories.
static void load(java.lang.String path, java.lang.String botid)
          Loads the Graphmaster with the contents of a given path.
static void markReady()
          Marks the end of loadtime.
static Match match(java.lang.String input, java.lang.String that, java.lang.String topic, java.lang.String botid)
           Searches for a match in the Graphmaster to a given path.
static int patternVocabularySize()
          Returns the pattern vocabulary size.
static void shutdown()
          Tells the PredicateMaster to save all predicates.
static void unload(java.lang.Object path, Bot bot)
          Removes all nodes associated with a given filename, and removes the file from the list of loaded files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String[] COPYRIGHT
Copyright notice.


VERSION

public static final java.lang.String VERSION
Version of this package.

See Also:
Constant Field Values

BUILD

public static final java.lang.String BUILD
Build Number of this package (internal regression test control).

See Also:
Constant Field Values

TEMPLATE

public static final java.lang.String TEMPLATE
A template marker.

See Also:
Constant Field Values

THAT

public static final java.lang.String THAT
A that marker.

See Also:
Constant Field Values

TOPIC

public static final java.lang.String TOPIC
A topic marker.

See Also:
Constant Field Values

BOTID

public static final java.lang.String BOTID
A botid marker.

See Also:
Constant Field Values

FILENAME

public static final java.lang.String FILENAME
A filename marker.

See Also:
Constant Field Values

ASTERISK

public static final java.lang.String ASTERISK
The * wildcard.

See Also:
Constant Field Values

UNDERSCORE

public static final java.lang.String UNDERSCORE
The _ wildcard.

See Also:
Constant Field Values

PATH_SEPARATOR

public static final java.lang.String PATH_SEPARATOR
A path separator.

See Also:
Constant Field Values

ACTIVATIONS

public static final java.lang.String ACTIVATIONS
Activations marker.

See Also:
Constant Field Values

RESPONSE_TIMEOUT

protected static int RESPONSE_TIMEOUT
The response timeout.

Method Detail

add

public static Nodemapper add(java.lang.String pattern,
                             java.lang.String that,
                             java.lang.String topic,
                             java.lang.String botid)
Adds a new pattern-that-topic path to the Graphmaster root.

Parameters:
pattern - <pattern/> path component
that - <that/> path component
topic - <topic/> path component
botid -
Returns:
Nodemapper which is the result of adding the path.

match

public static Match match(java.lang.String input,
                          java.lang.String that,
                          java.lang.String topic,
                          java.lang.String botid)
                   throws NoMatchException

Searches for a match in the Graphmaster to a given path.

This is a high-level prototype, used for external access. It is not synchronized!

Parameters:
input - <input/> path component
that - <that/> path component
topic - <topic/> path component
botid - <botid/> path component
Returns:
the resulting Match object
Throws:
NoMatchException - if no match was found
See Also:
#match(Nodemapper, Nodemapper, String, String, String, boolean, boolean, boolean)

markReady

public static void markReady()
Marks the end of loadtime. Depending on settings in Globals, displays various trace information on the console, and writes startup information to the log..


shutdown

public static void shutdown()
Tells the PredicateMaster to save all predicates.


activatedNode

public static void activatedNode(Nodemapper nodemapper)
Adds a given Nodemapper to the set of activated nodes.


checkpoint

public static void checkpoint()
Sends new targeting data to org.alicebot.server.core.util.TargetMaster.


load

public static void load(java.lang.String path,
                        java.lang.String botid)
Loads the Graphmaster with the contents of a given path.

Parameters:
path - path to the file(s) to load
botid -

unload

public static void unload(java.lang.Object path,
                          Bot bot)
Removes all nodes associated with a given filename, and removes the file from the list of loaded files.

Parameters:
filename - the filename

getTotalCategories

public static int getTotalCategories()
Returns the number of categories presently loaded.

Returns:
the number of categories presently loaded

incrementTotalCategories

public static int incrementTotalCategories()
Increments the total categories.

Returns:
the number of categories presently loaded

patternVocabularySize

public static int patternVocabularySize()
Returns the pattern vocabulary size.

Returns:
the pattern vocabulary size

getWorkingDirectory

public static java.lang.String getWorkingDirectory()
Returns the working directory.

Returns:
the working directory