org.alicebot.server.core.targeting
Class TargetingTool

java.lang.Object
  extended by org.alicebot.server.core.targeting.Targeting
      extended by org.alicebot.server.core.targeting.TargetingTool
All Implemented Interfaces:
java.lang.Runnable

public class TargetingTool
extends Targeting
implements java.lang.Runnable

Manages the use of the Targeting GUI.

Author:
Noel Bush

Field Summary
static java.lang.String VERSION
          Version string.
 
Fields inherited from class org.alicebot.server.core.targeting.Targeting
CATEGORY_END, CATEGORY_START, EMPTY_STRING, INDENT, INPUT_END, INPUT_START, LINE_SEPARATOR, MATCH_END, MATCH_START, PATTERN_END, PATTERN_START, REPLY_END, REPLY_START, SPACE, TARGET_END, TARGET_START, TARGETS, TARGETS_END, TARGETS_START, TEMPLATE_END, TEMPLATE_START, TEXT_END, TEXT_START, THAT_END, THAT_START, TOPIC_END, TOPIC_NAME_BEGIN, TOPIC_NAME_END, TOPIC_START
 
Constructor Summary
TargetingTool()
          Creates a new instance of TargetingTool, loading targets from targets data path.
 
Method Summary
(package private) static void add(Target target, java.util.HashMap set)
          Adds a target to the specified set.
 void changeTargetsDataPath(java.lang.String path)
          Changes the targets data path and loads data from the new file.
static int countDiscarded()
          Returns the number of discarded targets.
static int countLive()
          Returns the number of live targets.
static int countSaved()
          Returns the number of saved targets.
static void discard(Target target)
          Discards a target from the live targets.
static void discardAll()
          Discards all targets from the live targets.
 int getReloadFrequency()
          Returns the current timer frequency, in seconds.
static java.util.List getSortedTargets()
          Returns the live target set, sorted by the activations count.
 java.lang.String getTargetsDataPath()
          Returns the current targets data path.
 boolean includeIncompleteThats()
          Returns whether incomplete-that targets should be included.
 void includeIncompleteThats(boolean b)
          Specifies whether incomplete-that targets should be included.
 boolean includeIncompleteTopics()
          Returns whether incomplete-topic targets should be included.
 void includeIncompleteTopics(boolean b)
          Specifies whether incomplete-topic targets should be included.
static void main(java.lang.String[] args)
          Starts up a new Targets, managed by a Thread.
static Target nextTarget()
          Returns a new target from the live targets.
 void reload()
          Reloads targets from the targets data path into the live targets cache.
 void restartTimer(int frequency)
          Starts the target data checking task with a given frequency.
 void run()
          Starts the Targeting GUI (and the timer, if configured).
static void save(Target target)
          Saves a target from the live targets (does not create a new category.
static void saveCategory(Target target)
          Saves a new category to the targets AIML file.
static void shutdown()
          Performs any steps necessary before shutdown of the tool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
Version string.

See Also:
Constant Field Values
Constructor Detail

TargetingTool

public TargetingTool()
Creates a new instance of TargetingTool, loading targets from targets data path.

Method Detail

reload

public void reload()
            throws java.io.IOException,
                   java.net.MalformedURLException
Reloads targets from the targets data path into the live targets cache.

Throws:
java.io.IOException
java.net.MalformedURLException

run

public void run()
Starts the Targeting GUI (and the timer, if configured).

Specified by:
run in interface java.lang.Runnable

restartTimer

public void restartTimer(int frequency)
Starts the target data checking task with a given frequency.

Parameters:
frequency - seconds in between target data checks

getReloadFrequency

public int getReloadFrequency()
Returns the current timer frequency, in seconds.

Returns:
the current timer frequency, in seconds

add

static void add(Target target,
                java.util.HashMap set)
Adds a target to the specified set. If the set is liveTargets, then if the target is already in the live targets set, the new target is merged with the already-known target.

Parameters:
target - the target to add
set - the target set to which to add it
See Also:
Target#merge}

saveCategory

public static void saveCategory(Target target)
Saves a new category to the targets AIML file.

Parameters:
target - the target to save

nextTarget

public static Target nextTarget()
Returns a new target from the live targets.

Returns:
a new target from the live targets

save

public static void save(Target target)
Saves a target from the live targets (does not create a new category.

Parameters:
target - the target to discard

discardAll

public static void discardAll()
Discards all targets from the live targets.


discard

public static void discard(Target target)
Discards a target from the live targets.

Parameters:
target - the target to discard

getSortedTargets

public static java.util.List getSortedTargets()
Returns the live target set, sorted by the activations count.

Returns:
the live target set

countLive

public static int countLive()
Returns the number of live targets.

Returns:
the number of live targets

countSaved

public static int countSaved()
Returns the number of saved targets.

Returns:
the number of saved targets

countDiscarded

public static int countDiscarded()
Returns the number of discarded targets.

Returns:
the number of discarded targets

shutdown

public static void shutdown()
Performs any steps necessary before shutdown of the tool.


getTargetsDataPath

public java.lang.String getTargetsDataPath()
Returns the current targets data path.

Returns:
the current targets data path

changeTargetsDataPath

public void changeTargetsDataPath(java.lang.String path)
Changes the targets data path and loads data from the new file.

Parameters:
path - the desired targets data path

includeIncompleteThats

public boolean includeIncompleteThats()
Returns whether incomplete-that targets should be included.

Returns:
whether incomplete-that targets should be included

includeIncompleteTopics

public boolean includeIncompleteTopics()
Returns whether incomplete-topic targets should be included.

Returns:
whether incomplete-topic targets should be included

includeIncompleteThats

public void includeIncompleteThats(boolean b)
Specifies whether incomplete-that targets should be included.

Parameters:
b - whether incomplete-that targets should be included

includeIncompleteTopics

public void includeIncompleteTopics(boolean b)
Specifies whether incomplete-topic targets should be included.

Parameters:
b - whether incomplete-topic targets should be included

main

public static void main(java.lang.String[] args)
Starts up a new Targets, managed by a Thread.