unsw.cse.framescript
Class MicaBot

java.lang.Object
  extended by unsw.cse.mica.agent.DefaultAgent
      extended by unsw.cse.framescript.MicaBot
All Implemented Interfaces:
Conversation, unsw.cse.mica.agent.Agent, unsw.cse.mica.agent.MessageHandler

public class MicaBot
extends unsw.cse.mica.agent.DefaultAgent
implements Conversation

A Mica agent that acts as a bridge between Mica and FrameScript.

Author:
mmcgill

Field Summary
static java.lang.String AlternativeUtterancesSlot
           
static int DefaultPort
           
static java.lang.String DefaultServer
           
static java.lang.String InputTextMob
           
static java.lang.String mobPrefix
           
static java.lang.String OutputTextMob
           
static java.lang.String ParamDomain
           
static java.lang.String ParamFile
           
static java.lang.String ParamInit
           
static java.lang.String ParamTopic
           
static boolean TransientOutputs
           
static java.lang.String UtteranceSlot
           
 
Fields inherited from class unsw.cse.mica.agent.DefaultAgent
at
 
Fields inherited from interface unsw.cse.framescript.Conversation
AlternateRequest, NoMoreAlternatesResponse
 
Constructor Summary
MicaBot()
           
 
Method Summary
static MicaBot check_micabot(Atom functionName, Instance currentObject, Term[] arg, int n, StackFrame frame)
          Convenience routine to check micabot arguments for built-in functions.
static Instance check_mob(Atom functionName, Instance currentObject, Term[] arg, int n, StackFrame frame)
          Convenience routine to check mob arguments for built-in functions.
 Atom connect(java.lang.String agentName)
           
 void deleteMob(java.lang.String mobName)
           
static MicaBot getCurrentMicaBot(Atom functor)
           
static MobInstance getMobInstance(unsw.cse.mica.data.Mob m, MicaBot bot)
           
static MobGeneric getMobType(java.lang.String mobType, MicaBot bot, unsw.cse.mica.data.TypeManager tm)
           
static java.lang.String getMobType(Term t)
           
 Pattern getResponse(Pattern input)
          Asks the MicaBot to process a given pattern.
 java.lang.String getResponse(java.lang.String input)
          Asks the MicaBot to get a response to an input string.
 java.lang.String getResponse(java.lang.String input, java.lang.String[] alternatives)
          Asks the MicaBot to get a response to an input string.
 void handleDeletedMob(unsw.cse.mica.data.Mob m)
           
 void handleNewMob(unsw.cse.mica.data.Mob m)
           
 void handleReplacedMob(unsw.cse.mica.data.Mob oldMob, unsw.cse.mica.data.Mob newMob)
           
 void handleTypeManagerChanged()
           
static void init(MicaBot bot)
           
 void init(unsw.cse.mica.util.MicaProperties args)
           
static void main(java.lang.String[] args)
           
 void processInput(Pattern input)
          Tells the conversation to treat a pattern as user input.
 void processInput(java.lang.String input)
          Tells the conversation to treat a string as user input.
 void processInput(java.lang.String input, java.lang.String[] alternatives)
          Tells the conversation to treat a string as user input.
 FSList queryMica(java.lang.String query)
           
 Instance readMob(java.lang.String mobName)
           
 void register(java.lang.String mobType)
           
 void replaceMob(Instance mob)
           
static void reportException(java.lang.Exception e, MicaBot bot)
           
 void sendResponse(java.lang.String response)
           
 void setNoMoreAltsSuffix(Term suffix)
          Sets a string that will be returned with the NOMORESALTS response.
 void setTransport(unsw.cse.mica.agent.AgentTransport at)
          Ensures that MicaBot uses a synchronised agent transport.
 void terminate()
           
 void unregister(java.lang.String mobType)
           
 Instance writeAndWaitForReply(Instance mob, long timeout)
           
 Atom writeMob(Instance mob)
           
 
Methods inherited from class unsw.cse.mica.agent.DefaultAgent
getTransport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DefaultServer

public static final java.lang.String DefaultServer
See Also:
Constant Field Values

DefaultPort

public static final int DefaultPort
See Also:
Constant Field Values

mobPrefix

public static final java.lang.String mobPrefix
See Also:
Constant Field Values

InputTextMob

public static java.lang.String InputTextMob

OutputTextMob

public static java.lang.String OutputTextMob

UtteranceSlot

public static java.lang.String UtteranceSlot

AlternativeUtterancesSlot

public static java.lang.String AlternativeUtterancesSlot

ParamInit

public static java.lang.String ParamInit

ParamFile

public static java.lang.String ParamFile

ParamDomain

public static java.lang.String ParamDomain

ParamTopic

public static java.lang.String ParamTopic

TransientOutputs

public static boolean TransientOutputs
Constructor Detail

MicaBot

public MicaBot()
Method Detail

setTransport

public void setTransport(unsw.cse.mica.agent.AgentTransport at)
Ensures that MicaBot uses a synchronised agent transport.

Specified by:
setTransport in interface unsw.cse.mica.agent.Agent
Overrides:
setTransport in class unsw.cse.mica.agent.DefaultAgent

init

public void init(unsw.cse.mica.util.MicaProperties args)
          throws unsw.cse.mica.MicaException
Specified by:
init in interface unsw.cse.mica.agent.Agent
Specified by:
init in class unsw.cse.mica.agent.DefaultAgent
Throws:
unsw.cse.mica.MicaException

handleNewMob

public void handleNewMob(unsw.cse.mica.data.Mob m)
Specified by:
handleNewMob in interface unsw.cse.mica.agent.MessageHandler
Specified by:
handleNewMob in class unsw.cse.mica.agent.DefaultAgent

handleReplacedMob

public void handleReplacedMob(unsw.cse.mica.data.Mob oldMob,
                              unsw.cse.mica.data.Mob newMob)
Specified by:
handleReplacedMob in interface unsw.cse.mica.agent.MessageHandler
Overrides:
handleReplacedMob in class unsw.cse.mica.agent.DefaultAgent

handleDeletedMob

public void handleDeletedMob(unsw.cse.mica.data.Mob m)
Specified by:
handleDeletedMob in interface unsw.cse.mica.agent.MessageHandler
Overrides:
handleDeletedMob in class unsw.cse.mica.agent.DefaultAgent

handleTypeManagerChanged

public void handleTypeManagerChanged()
Specified by:
handleTypeManagerChanged in interface unsw.cse.mica.agent.MessageHandler
Overrides:
handleTypeManagerChanged in class unsw.cse.mica.agent.DefaultAgent

terminate

public void terminate()
Specified by:
terminate in interface unsw.cse.mica.agent.Agent
Overrides:
terminate in class unsw.cse.mica.agent.DefaultAgent

processInput

public void processInput(java.lang.String input)
                  throws FSException
Description copied from interface: Conversation
Tells the conversation to treat a string as user input.

Specified by:
processInput in interface Conversation
Throws:
FSException

processInput

public void processInput(java.lang.String input,
                         java.lang.String[] alternatives)
                  throws FSException
Description copied from interface: Conversation
Tells the conversation to treat a string as user input. Alternative inputs can provided for scripts that are designed to used them.

Specified by:
processInput in interface Conversation
Throws:
FSException

processInput

public void processInput(Pattern input)
                  throws FSException
Description copied from interface: Conversation
Tells the conversation to treat a pattern as user input.

Specified by:
processInput in interface Conversation
Throws:
FSException

setNoMoreAltsSuffix

public void setNoMoreAltsSuffix(Term suffix)
Description copied from interface: Conversation
Sets a string that will be returned with the NOMORESALTS response.

Specified by:
setNoMoreAltsSuffix in interface Conversation

sendResponse

public void sendResponse(java.lang.String response)
                  throws unsw.cse.mica.MicaException
Throws:
unsw.cse.mica.MicaException

getResponse

public java.lang.String getResponse(java.lang.String input)
                             throws FSException
Asks the MicaBot to get a response to an input string.

Parameters:
input - the text to be processed
Returns:
the resultant response
Throws:
FSException

getResponse

public java.lang.String getResponse(java.lang.String input,
                                    java.lang.String[] alternatives)
                             throws FSException
Asks the MicaBot to get a response to an input string.

Parameters:
input - the text to be processed
alternatives - alternative recognition results
Returns:
the resultant response
Throws:
FSException

getResponse

public Pattern getResponse(Pattern input)
                    throws FSException
Asks the MicaBot to process a given pattern.

Parameters:
input - the pattern to be processed
Returns:
the response from the MicaBot's domain
Throws:
FSException

getMobInstance

public static MobInstance getMobInstance(unsw.cse.mica.data.Mob m,
                                         MicaBot bot)

getMobType

public static MobGeneric getMobType(java.lang.String mobType,
                                    MicaBot bot,
                                    unsw.cse.mica.data.TypeManager tm)

reportException

public static void reportException(java.lang.Exception e,
                                   MicaBot bot)

getMobType

public static java.lang.String getMobType(Term t)

connect

public Atom connect(java.lang.String agentName)
             throws FSMicaException
Throws:
FSMicaException

register

public void register(java.lang.String mobType)
              throws FSMicaException
Throws:
FSMicaException

unregister

public void unregister(java.lang.String mobType)
                throws FSMicaException
Throws:
FSMicaException

writeMob

public Atom writeMob(Instance mob)
              throws FSMicaException
Throws:
FSMicaException

replaceMob

public void replaceMob(Instance mob)
                throws FSMicaException
Throws:
FSMicaException

readMob

public Instance readMob(java.lang.String mobName)
                 throws FSMicaException
Throws:
FSMicaException

deleteMob

public void deleteMob(java.lang.String mobName)
               throws FSMicaException
Throws:
FSMicaException

queryMica

public FSList queryMica(java.lang.String query)
                 throws FSMicaException
Throws:
FSMicaException

writeAndWaitForReply

public Instance writeAndWaitForReply(Instance mob,
                                     long timeout)
                              throws FSMicaException
Throws:
FSMicaException

main

public static void main(java.lang.String[] args)
                 throws FSException
Throws:
FSException

check_micabot

public static MicaBot check_micabot(Atom functionName,
                                    Instance currentObject,
                                    Term[] arg,
                                    int n,
                                    StackFrame frame)
                             throws FSException
Convenience routine to check micabot arguments for built-in functions.

Parameters:
functionName - name of the function calling the routine
currentObject - the current enclosing instance frame
arg - the arguements to the function
n - the index of the argument being checked
frame - a StackFrame containing contextual information
Returns:
the micabot arguement
Throws:
FRSerror - if the argument isn't a micabot
FSException

check_mob

public static Instance check_mob(Atom functionName,
                                 Instance currentObject,
                                 Term[] arg,
                                 int n,
                                 StackFrame frame)
                          throws FSException
Convenience routine to check mob arguments for built-in functions.

Parameters:
functionName - name of the function calling the routine
currentObject - the current enclosing instance frame
arg - the arguements to the function
n - the index of the argument being checked
frame - a StackFrame containing contextual information
Returns:
the mob arguement
Throws:
FRSerror - if the argument isn't a mob
FSException

getCurrentMicaBot

public static MicaBot getCurrentMicaBot(Atom functor)
                                 throws FSException
Throws:
FSException

init

public static void init(MicaBot bot)
                 throws FSException
Throws:
FSException