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
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 |
yesno
protected AppGrammar yesno
choice
protected AppGrammar choice
options
protected Vector options
question
protected String question
qObject
protected Question qObject
AskerAgent
public AskerAgent()
throws RemoteException
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 askoptions
- 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)