agentland.util.asker
Class MultimodalAskerAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.GoodAgent
                                |
                                +--agentland.resource.ManagedAgent
                                      |
                                      +--agentland.util.asker.MultimodalAskerAgent
All Implemented Interfaces:
Agent, BetterAsker, Good, GoodAsker, Managed, MetagluePrimitives, MultimodalAsker, Remote, Serializable, Spy

public class MultimodalAskerAgent
extends ManagedAgent
implements MultimodalAsker

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Field Summary
protected  Hashtable answers
           
protected  BetterAsker gAsker
           
protected  Hashtable holders
           
protected  BetterAsker sAsker
           
 
Fields inherited from class agentland.resource.ManagedAgent
rm, society
 
Fields inherited from class agentland.util.GoodAgent
alert, notifier
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface agentland.util.asker.GoodAsker
ERROR, MAYBE, NO, UNKNOWN, YES
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
MultimodalAskerAgent()
           
 
Method Summary
 Question ask(Question q)
           
 int ask(String q)
          Asks q, looks for a yes/no/maybe/unknown response
 int ask(String q, int timeout)
           
 Object askChoice(String question, Vector options)
          Asks a question and accepts one of the options as an answer
 Object askChoice(String question, Vector options, Object defaultAnswer)
          As above but includes a default answer
 String askFree(String q)
          Ask free response question--this is not all that usefull given the getDictation method of grammars, but it is better form? Maybe?
protected  void dispatchQuestion(BetterAsker asker, Question q)
           
protected  void dispatchQuestion(Question q)
           
protected  Object getAnswer(String q)
           
protected  boolean isAnswered(String sq)
           
 void tell(Secret s)
          We are listening to the underling askers--when we hear of a response, we stash it!
 String testAskChoice()
          A testing method
protected  void verify(Question q)
           
protected  void waitForAnswer(String q)
          Waits for an answer to the question; when it is woken up, it checks if the answer has been given to this question.
 
Methods inherited from class agentland.resource.ManagedAgent
connect, getAlert, getNeed, isAvailable, isAvailable, reliesOn, reliesOn, replace, replace, request, request, request, requestAgent, requestAgent, resources, resourcesByAgentID, setNeed, tiedTo, yank, yank, yank
 
Methods inherited from class agentland.util.GoodAgent
addSpy, addSpy, alert, alertString, beep, error, getHistory, getHistoryElement, getPersistentMap, log, notify, removeSpy, removeSpy, resetHistory, safeRely, safeRely, safeRely, setNiceLogName
 
Methods inherited from class metaglue.AgentAgent
addMonitor, alive, buildEHAFor, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getOldLogs, getProperties, getProxyHandlerClass, getSociety, installAPH, log, log, lookupClass, reliesOn, reliesOnSynch, removeAPHFromCatalog, removeFrozen, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, toString, whereAreYou
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface metaglue.Agent
addMonitor, alive, getAgentID, getMetaglueAgentID, getOldLogs, shutdown, startup, whereAreYou
 
Methods inherited from interface agentland.resource.Managed
getNeed, replace, replace, resources, yank, yank
 
Methods inherited from interface agentland.util.Good
getHistory, getHistoryElement, resetHistory
 

Field Detail

sAsker

protected BetterAsker sAsker

gAsker

protected BetterAsker gAsker

answers

protected Hashtable answers

holders

protected Hashtable holders
Constructor Detail

MultimodalAskerAgent

public MultimodalAskerAgent()
                     throws RemoteException
Method Detail

ask

public Question ask(Question q)
             throws RemoteException
Specified by:
ask in interface BetterAsker

ask

public int ask(String q)
        throws RemoteException
Asks q, looks for a yes/no/maybe/unknown response
Specified by:
ask in interface GoodAsker

ask

public int ask(String q,
               int timeout)
        throws RemoteException
Specified by:
ask in interface GoodAsker
Parameters:
timeout - number of seconds until it gives up on your sorry ass.

askFree

public String askFree(String q)
               throws RemoteException
Ask free response question--this is not all that usefull given the getDictation method of grammars, but it is better form? Maybe?
Specified by:
askFree in interface GoodAsker

askChoice

public Object askChoice(String question,
                        Vector options)
                 throws RemoteException
Asks a question and accepts one of the options as an answer
Specified by:
askChoice in interface GoodAsker
Parameters:
question - question to ask
options - Vector of strings -- possible answers
Returns:
the answer

askChoice

public Object askChoice(String question,
                        Vector options,
                        Object defaultAnswer)
                 throws RemoteException
As above but includes a default answer
Specified by:
askChoice in interface GoodAsker

testAskChoice

public String testAskChoice()
                     throws RemoteException
A testing method
Specified by:
testAskChoice in interface MultimodalAsker

dispatchQuestion

protected void dispatchQuestion(Question q)

dispatchQuestion

protected void dispatchQuestion(BetterAsker asker,
                                Question q)

getAnswer

protected Object getAnswer(String q)

isAnswered

protected boolean isAnswered(String sq)

waitForAnswer

protected void waitForAnswer(String q)
Waits for an answer to the question; when it is woken up, it checks if the answer has been given to this question. If so, it returns, otherwise it waits again.
Parameters:
q - The question we are waiting on

tell

public void tell(Secret s)
          throws RemoteException
We are listening to the underling askers--when we hear of a response, we stash it!
Specified by:
tell in interface Spy
Overrides:
tell in class GoodAgent
Following copied from interface: agentland.util.Spy
Parameters:
secret - a Secret value
Throws:
RemoteException - if an error occurs

verify

protected void verify(Question q)