|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.rmi.server.RemoteObject | +--java.rmi.server.RemoteServer | +--java.rmi.server.UnicastRemoteObject | +--metaglue.AgentAgent | +--agentland.util.GoodAgent | +--agentland.resource.ManagedAgent | +--agentland.behavior.BehaviorCoordinatorAgent
The BehaviorCoordinatorAgent
is the crux of the Reactive
Behavioral System. It serves as the interface between the outside
perceptual world and all the behaviors. A Behavior must be registered
with the Behavior Coordinator of a Room to receive information about
the Room.
The Behavior Coordinator is what keeps track of which bevs are inactive,
listening, active leaf, active overriden. It decides which behaviors
receive the events.
BehaviorAgent
,
ManagedAgent
,
BehaviorCoordinator
, Serialized FormInner classes inherited from class metaglue.AgentAgent |
AgentAgent.Attribute |
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 |
Constructor Summary | |
BehaviorCoordinatorAgent()
Creates a new BehaviorCoordinatorAgent instance. |
Method Summary | |
void |
addBev(BehaviorID bid)
How a Behavior is registered with the Coordinator. |
Vector |
getActiveBevs()
Returns the collection of active behaviors |
String |
getBevNames()
Returns a String representation of the status of all the bevs registered with the bev coord. |
String |
getEvents()
Returns a String Representation of the Events that the bev coord listens for. |
Vector |
getInactiveBevs()
Returns the collection of inactive behaviors |
Vector |
getLeafBevs()
Returns the collection of leaf behaviors. |
Vector |
getListeningBevs()
Returns the collection of listening behaviors |
String |
getTree()
Returns a String Representation of the current active bev tree. |
boolean |
isBevActive(BehaviorID bevID)
Returns true if the Behavior with BehaviorID bevID is currently active. |
void |
tell(Secret secret)
(This is how the Behavior Coordinator ever gets anything done.) |
void |
updateBev(BehaviorID bevID,
int oldstate,
int newstate)
A Behavior calls this method to tell the coordinator about a change in its state. |
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 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 agentland.resource.Managed |
getNeed, replace, replace, resources, yank, yank |
Methods inherited from interface agentland.util.Good |
getHistory, getHistoryElement, resetHistory |
Methods inherited from interface metaglue.Agent |
addMonitor, alive, getAgentID, getMetaglueAgentID, shutdown, startup, whereAreYou |
Constructor Detail |
public BehaviorCoordinatorAgent() throws RemoteException
BehaviorCoordinatorAgent
instance. RemoteException
- if an error occursMethod Detail |
public void addBev(BehaviorID bid) throws RemoteException
addBev
in interface BehaviorCoordinator
bid
- the BehaviorID
of the Behavior to be
registeredRemoteException
- if an error occurspublic String getBevNames() throws RemoteException
Registered Bevs:
***
***
***
***
Inactive Bevs:
***
Listening Bevs:
***
Active Bevs:
***
***
Leaf Active Bevs:
***
getBevNames
in interface BehaviorCoordinator
String
representationRemoteException
- if an error occurspublic String getTree() throws RemoteException
Doesn't work yet!
getTree
in interface BehaviorCoordinator
String
representationRemoteException
- if an error occurspublic String getEvents() throws RemoteException
getEvents
in interface BehaviorCoordinator
String
representationRemoteException
- if an error occurspublic boolean isBevActive(BehaviorID bevID) throws RemoteException
isBevActive
in interface BehaviorCoordinator
bevID
- a BehaviorID
valueboolean
valueRemoteException
- if an error occurspublic void tell(Secret secret)
After getting an event, this method passes it to all the leaf active bevs (which in turn passes it up the active behavioral tree). Then it passes the secret to all the listening bevs, and checks whether any of them get activated. Finally, it cycles through the inactive bevs and checks whether any of them should be listening.
tell
in interface Spy
tell
in class GoodAgent
secret
- the event to be passed (as a Secret
)public void updateBev(BehaviorID bevID, int oldstate, int newstate)
0 - inactive
1 - listening
2 - active leaf
3 - active, non-leaf (i.e., overriden)
updateBev
in interface BehaviorCoordinator
bevID
- the BehaviorID
of the behavior that's
telling the bev coord about the change in its stateoldstate
- the old state, as an int
valuenewstate
- the new state, as an int
valuepublic Vector getLeafBevs()
getLeafBevs
in interface BehaviorCoordinator
Vector
of BehaviorIDspublic Vector getActiveBevs()
getActiveBevs
in interface BehaviorCoordinator
Vector
of BehaviorIDspublic Vector getListeningBevs()
getListeningBevs
in interface BehaviorCoordinator
Vector
of BehaviorIDspublic Vector getInactiveBevs()
getInactiveBevs
in interface BehaviorCoordinator
Vector
of BehaviorIDs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |