speech.tools
Class AskerAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.GoodAgent
                                |
                                +--agentland.resource.ManagedAgent
                                      |
                                      +--speech.tools.ManagedSpeechAgent
                                            |
                                            +--speech.tools.AskerAgent
All Implemented Interfaces:
Agent, Asker, BetterAsker, Good, GoodAsker, Managed, ManagedSpeech, MetagluePrimitives, Remote, RemoteTagsListener, Serializable, Speech, Spy

public class AskerAgent
extends ManagedSpeechAgent
implements Speech, Asker

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Field Summary
protected  AppGrammar choice
           
protected  Vector options
           
protected  Question qObject
           
protected  String question
           
protected  AppGrammar yesno
           
 
Fields inherited from class speech.tools.ManagedSpeechAgent
voice
 
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 metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Fields inherited from interface agentland.util.asker.GoodAsker
ERROR, MAYBE, NO, UNKNOWN, YES
 
Constructor Summary
AskerAgent()
           
 
Method Summary
 void acceptedTagsResult(Hashtable tags)
           
 int analyze(Hashtable response)
          Analyze response to a yes/no/maybe question
 Question ask(Question q)
           
 int ask(String q)
          Ask a yes/no/maybe question
 int ask(String q, int timeout)
          As above but with a possiblity of specifying a 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)
          Ask a question with a number of options
 String askFree(String q)
          Ask a free response question
protected  Hashtable doAsk(String q, AppGrammar g, boolean tell)
          Asks a grammar-driven question
protected  void presentOptions()
           
protected  void sendAnswer(Object answer, boolean verify)
          Process the answer (i.e.
 void tell(Secret s)
          Receives notifications about the question being answered by somebody else
 
Methods inherited from class speech.tools.ManagedSpeechAgent
getDictation, loadGrammar, loadGrammar, say, saySync
 
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 agentland.util.Good
getHistory, getHistoryElement, resetHistory
 
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
 

Field Detail

yesno

protected AppGrammar yesno

choice

protected AppGrammar choice

options

protected Vector options

question

protected String question

qObject

protected Question qObject
Constructor Detail

AskerAgent

public AskerAgent()
           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
Ask a yes/no/maybe question
Specified by:
ask in interface GoodAsker
Parameters:
q - The question to ask

ask

public int ask(String q,
               int timeout)
        throws RemoteException
As above but with a possiblity of specifying a timeout
Specified by:
ask in interface GoodAsker
Parameters:
timeout - timeout in seconds

askChoice

public Object askChoice(String question,
                        Vector options,
                        Object defaultAnswer)
                 throws RemoteException
Ask a question with a number of options
Specified by:
askChoice in interface GoodAsker
Parameters:
q - The question to ask

askChoice

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

askFree

public String askFree(String q)
               throws RemoteException
Ask a free response question
Specified by:
askFree in interface GoodAsker
Parameters:
q - The question to ask

analyze

public int analyze(Hashtable response)
Analyze response to a yes/no/maybe question
Parameters:
response - tags (as passed to the acceptedTagsResult method)

acceptedTagsResult

public void acceptedTagsResult(Hashtable tags)
                        throws RemoteException
Overrides:
acceptedTagsResult in class ManagedSpeechAgent

presentOptions

protected void presentOptions()
                       throws RemoteException

doAsk

protected Hashtable doAsk(String q,
                          AppGrammar g,
                          boolean tell)
Asks a grammar-driven question
Parameters:
tell - speak the question ourselves?

tell

public void tell(Secret s)
          throws RemoteException
Receives notifications about the question being answered by somebody else
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

sendAnswer

protected void sendAnswer(Object answer,
                          boolean verify)
Process the answer (i.e. send an appropriate notification)