org.alicebot.server.core.targeting
Class Target

java.lang.Object
  extended by org.alicebot.server.core.targeting.Target

public class Target
extends java.lang.Object

Represents an individial target.


Constructor Summary
Target(java.lang.String matchPattern, java.lang.String matchThat, java.lang.String matchTopic, java.lang.String matchTemplate, java.lang.String inputText, java.lang.String inputThat, java.lang.String inputTopic, java.lang.String reply)
          Creates a new Target object.
 
Method Summary
 void extend()
          Generates extension patterns for all inputs.
static int generateHashCode(java.lang.String matchPattern, java.lang.String matchThat, java.lang.String matchTopic)
          Returns a hash code that would be generated for a target with the given parameters.
 int getActivations()
          Returns the activations count.
 java.util.LinkedList getExtensionPatterns()
          Returns the extension patterns.
 StringTripleMatrix getExtensions()
          Returns the extensions.
 java.util.LinkedList getExtensionThats()
          Returns the extension thats.
 java.util.LinkedList getExtensionTopics()
          Returns the extension topics.
 java.lang.String getFirstExtensionPattern()
          Returns the first extension pattern.
 java.lang.String getFirstExtensionThat()
          Returns the first extension that.
 java.lang.String getFirstExtensionTopic()
          Returns the first extension topic.
 java.lang.String getFirstInputText()
          Returns the first input text.
 java.lang.String getFirstInputThat()
          Returns the first input that.
 java.lang.String getFirstInputTopic()
          Returns the first input topic.
 java.lang.String getFirstReply()
          Returns the first reply.
 StringTripleMatrix getInputs()
          Returns the inputs.
 java.util.LinkedList getInputTexts()
          Returns the input texts.
 java.util.LinkedList getInputThats()
          Returns the input thats.
 java.util.LinkedList getInputTopics()
          Returns the input topics.
 java.lang.String getLastExtensionPattern()
          Returns the last extension pattern.
 java.lang.String getLastExtensionThat()
          Returns the last extension that.
 java.lang.String getLastExtensionTopic()
          Returns the last extension topic.
 java.lang.String getLastInputText()
          Returns the last input text.
 java.lang.String getLastInputThat()
          Returns the last input that.
 java.lang.String getLastInputTopic()
          Returns the last input topic.
 java.lang.String getLastReply()
          Returns the last reply.
 java.lang.String getMatchPattern()
          Returns the match pattern.
 java.lang.String getMatchTemplate()
          Returns the match template.
 java.lang.String getMatchThat()
          Returns the match that.
 java.lang.String getMatchTopic()
          Returns the match topic.
 java.lang.String getNewPattern()
          Returns the new pattern.
 java.lang.String getNewTemplate()
          Returns the new template.
 java.lang.String getNewThat()
          Returns the new that.
 java.lang.String getNewTopic()
          Returns the new topic.
 java.lang.String getNthExtensionPattern(int n)
          Returns the nth extension pattern.
 java.lang.String getNthExtensionThat(int n)
          Returns the nth extension that.
 java.lang.String getNthExtensionTopic(int n)
          Returns the nth extension topic.
 java.lang.String getNthInputText(int n)
          Returns the nth input text.
 java.lang.String getNthInputThat(int n)
          Returns the nth input that.
 java.lang.String getNthInputTopic(int n)
          Returns the nth input topic.
 java.lang.String getNthReply(int n)
          Returns the nth reply
 java.util.LinkedList getReplies()
          Returns the replys.
 int hashCode()
          Returns a hash code representing the target.
 void merge(Target target)
          Merges input and extension values from one target to this one.
 void setNewPattern(java.lang.String pattern)
          Sets the new pattern.
 void setNewTemplate(java.lang.String template)
          Sets the new template.
 void setNewThat(java.lang.String that)
          Sets the new that.
 void setNewTopic(java.lang.String topic)
          Sets the new topic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Target

public Target(java.lang.String matchPattern,
              java.lang.String matchThat,
              java.lang.String matchTopic,
              java.lang.String matchTemplate,
              java.lang.String inputText,
              java.lang.String inputThat,
              java.lang.String inputTopic,
              java.lang.String reply)
Creates a new Target object.

Parameters:
matchPattern - the pattern part of the matched path
matchThat - the that part of the matched path
matchTopic - the topic part of the matched path
matchTemplate - the template associated with the matched path
inputText - the input text that was matched
inputThat - the value of the that predicate when the input was received
inputTopic - the value of the topic predicate when the input was received
reply - the reply that the bot provided
Method Detail

hashCode

public int hashCode()
Returns a hash code representing the target.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code representing the target

generateHashCode

public static int generateHashCode(java.lang.String matchPattern,
                                   java.lang.String matchThat,
                                   java.lang.String matchTopic)
Returns a hash code that would be generated for a target with the given parameters.

Parameters:
matchPattern -
matchThat -
matchTopic -
Returns:
a hash code that would be generated for a target with the given parameters

merge

public void merge(Target target)
Merges input and extension values from one target to this one.

Parameters:
target - the target whose inputs will be added

getMatchPattern

public java.lang.String getMatchPattern()
Returns the match pattern.

Returns:
the match pattern

getMatchThat

public java.lang.String getMatchThat()
Returns the match that.

Returns:
the match that

getMatchTopic

public java.lang.String getMatchTopic()
Returns the match topic.

Returns:
the match topic

getMatchTemplate

public java.lang.String getMatchTemplate()
Returns the match template.

Returns:
the match template

getInputs

public StringTripleMatrix getInputs()
Returns the inputs.

Returns:
the inputs

getInputTexts

public java.util.LinkedList getInputTexts()
Returns the input texts.

Returns:
the input texts

getInputThats

public java.util.LinkedList getInputThats()
Returns the input thats.

Returns:
the input thats

getInputTopics

public java.util.LinkedList getInputTopics()
Returns the input topics.

Returns:
the input topics

getFirstInputText

public java.lang.String getFirstInputText()
Returns the first input text.

Returns:
the first input text

getFirstInputThat

public java.lang.String getFirstInputThat()
Returns the first input that.

Returns:
the first input that

getFirstInputTopic

public java.lang.String getFirstInputTopic()
Returns the first input topic.

Returns:
the first input topic

getLastInputText

public java.lang.String getLastInputText()
Returns the last input text.

Returns:
the last input text

getLastInputThat

public java.lang.String getLastInputThat()
Returns the last input that.

Returns:
the last input that

getLastInputTopic

public java.lang.String getLastInputTopic()
Returns the last input topic.

Returns:
the last input topic

getNthInputText

public java.lang.String getNthInputText(int n)
Returns the nth input text.

Parameters:
n - the index of the desired input text
Returns:
the nth input text

getNthInputThat

public java.lang.String getNthInputThat(int n)
Returns the nth input that.

Parameters:
n - the index of the desired input that
Returns:
the nth input that

getNthInputTopic

public java.lang.String getNthInputTopic(int n)
Returns the nth input topic.

Parameters:
n - the index of the desired input topic
Returns:
the nth input topic

getExtensions

public StringTripleMatrix getExtensions()
Returns the extensions.

Returns:
the extensions

getExtensionPatterns

public java.util.LinkedList getExtensionPatterns()
Returns the extension patterns.

Returns:
the extension patterns

getExtensionThats

public java.util.LinkedList getExtensionThats()
Returns the extension thats.

Returns:
the extension thats

getExtensionTopics

public java.util.LinkedList getExtensionTopics()
Returns the extension topics.

Returns:
the extension topics

getFirstExtensionPattern

public java.lang.String getFirstExtensionPattern()
Returns the first extension pattern.

Returns:
the first extension pattern

getFirstExtensionThat

public java.lang.String getFirstExtensionThat()
Returns the first extension that.

Returns:
the first extension that

getFirstExtensionTopic

public java.lang.String getFirstExtensionTopic()
Returns the first extension topic.

Returns:
the first extension topic

getLastExtensionPattern

public java.lang.String getLastExtensionPattern()
Returns the last extension pattern.

Returns:
the last extension pattern

getLastExtensionThat

public java.lang.String getLastExtensionThat()
Returns the last extension that.

Returns:
the last extension that

getLastExtensionTopic

public java.lang.String getLastExtensionTopic()
Returns the last extension topic.

Returns:
the last extension topic

getNthExtensionPattern

public java.lang.String getNthExtensionPattern(int n)
Returns the nth extension pattern.

Parameters:
n - the index of the desired extension pattern
Returns:
the nth extension pattern

getNthExtensionThat

public java.lang.String getNthExtensionThat(int n)
Returns the nth extension that.

Parameters:
n - the index of the desired extension that
Returns:
the nth extension that

getNthExtensionTopic

public java.lang.String getNthExtensionTopic(int n)
Returns the nth extension topic.

Parameters:
n - the index of the desired extension topic
Returns:
the nth extension topic

getReplies

public java.util.LinkedList getReplies()
Returns the replys.

Returns:
the replys

getFirstReply

public java.lang.String getFirstReply()
Returns the first reply.

Returns:
the first reply

getLastReply

public java.lang.String getLastReply()
Returns the last reply.

Returns:
the last reply

getNthReply

public java.lang.String getNthReply(int n)
Returns the nth reply

Parameters:
n - the index of the desired reply
Returns:
the nth reply

getNewPattern

public java.lang.String getNewPattern()
Returns the new pattern.

Returns:
the new pattern

getNewThat

public java.lang.String getNewThat()
Returns the new that.

Returns:
the new that

getNewTopic

public java.lang.String getNewTopic()
Returns the new topic.

Returns:
the new topic

getNewTemplate

public java.lang.String getNewTemplate()
Returns the new template.

Returns:
the new template

setNewPattern

public void setNewPattern(java.lang.String pattern)
Sets the new pattern.

Parameters:
pattern - the new pattern

setNewThat

public void setNewThat(java.lang.String that)
Sets the new that.

Parameters:
that - the new that

setNewTopic

public void setNewTopic(java.lang.String topic)
Sets the new topic.

Parameters:
topic - the new topic

setNewTemplate

public void setNewTemplate(java.lang.String template)
Sets the new template.

Parameters:
template - the new template

getActivations

public int getActivations()
Returns the activations count.

Returns:
the activations count

extend

public void extend()
Generates extension patterns for all inputs.