agentland.gui.tools
Class GuiAskerAgent

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

public class GuiAskerAgent
extends ManagedAgent
implements GuiAsker

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Field Summary
protected  Hashtable answers
           
protected  GuiManagerDaemon gmd
           
 
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
GuiAskerAgent()
           
 
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 q, Vector options, Object defaultAnswer)
          Asks a question and accepts one of the options as an 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?
 void tell(Secret s)
          This is called if the Agent is to receive a particular secret.
 String testAskChoice()
          A testing method
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, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getProperties, getSociety, log, log, lookupClass, obtainMetaglueAgent, obtainMetaglueAgent, obtainMetaglueAgentByName, reliesOn, reliesOnSynch, removeFrozen, replaceExceptionHandler, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, 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, toString, 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, 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

answers

protected Hashtable answers

gmd

protected GuiManagerDaemon gmd
Constructor Detail

GuiAskerAgent

public GuiAskerAgent()
              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 q,
                        Vector options,
                        Object defaultAnswer)
                 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

testAskChoice

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

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

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
Description copied from interface: Spy
This is called if the Agent is to receive a particular secret.
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