|
|||||||||
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.BehaviorAgent
BehaviorAgent
is the parent class for all
Behaviors.
Changes I will be making soon:
-> Use persistent maps and other forms of persistent storage
Ajay Kulkarni 7.25.2001
ManagedAgent
,
Behavior
, 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 | |
BehaviorAgent()
Creates a new BehaviorAgent instance.Contains the code that stores all the Actions of a particular Behavior subclass. |
Method Summary | |
void |
activate(Secret secret)
Each particular behavior -- i.e., a subclass of this class -- needs to implement this method. |
void |
activateAction(String actionName)
The BehaviorAgent itself calls this method to
restore an overriden action. |
void |
activateParent(BehaviorID bID)
Adds a parent to its Active Parent collection |
protected void |
addAction(Method action)
How a behavior adds its actions. |
void |
addActionDependency(BehaviorID parID,
String thisAction,
String parentAction)
Adds an action dependency between an action in this behavior and an action in another behavior (parent). |
void |
addChild(BehaviorID bID)
When this Behavior is no longer a Leaf Behavior, this method adds a connection the Bev(s) one level of hierarchy below this bev. |
protected void |
addEvent(String eventName,
String actionName)
How a behavior specifies what events (notifications) it wants to listen for, and what actions within the behavior listen for these events. |
void |
addParent(BehaviorID bID)
Adds a child-parent relationship between this behavior (child) and another behavior with ID bID . |
void |
addPermanentAction(String actionName)
Adds an action to the collection of Permanent Actions of this behavior. |
void |
deactivateParent(BehaviorID bID)
Removes a parent from the Active Parent collection |
void |
deleteActionDependency(BehaviorID parID,
String thisAction,
String parentAction)
Removes an action dependency between an action in this behavior and an action in another behavior (parent). If the parent is not registered with this behavior, returns an error message. |
Vector |
getActivationEvents()
Returns the events that ths behavior's activate method listens for... |
Vector |
getActiveParents()
Returns all parents of this child that are in an active state. |
Vector |
getAllEvents()
Returns all the events that this behavior listens for, i.e., the combination of getEvents() and getActivationEvents(). |
Vector |
getChildren()
Returns the behaviors that are at one level of hierarchy below this bev (in the active behavioral tree). |
String |
getDependencies()
Returns the names of the actions in all its parents that this behavior overrides. |
String |
getDependencies(BehaviorID parID)
Returns the names of the actions in parent with BehaviorID parID that this behavior overrides. |
Vector |
getDirectActiveParents()
Returns the active parents that are at one level of hierarchy above this bev (in the active behavioral tree). |
Vector |
getEvents()
Returns the events that this behavior's Actions listens for. |
BehaviorID |
getID()
Returns the BehaviorID of this Behavior. |
String |
getName()
Returns the name of this Behavior. |
Vector |
getOverridenActions()
Returns the names of the actions of this Behavior that have been overriden. |
Vector |
getParents()
Returns all parents of this child: i.e., all Behaviors such that a (child=>parent) relationship exists with this behavior (the child). |
Vector |
getPermanentActions()
Returns the names of the actions of this Behavior that can not be overriden by any other behavior. |
boolean |
isActive()
A Behavior can be in one of four states: 0: Inactive 1: Listening 2: Leaf Active 3: Overriden Active Returns true of this Behavior is Active. |
boolean |
isInactive()
A Behavior can be in one of four states: 0: Inactive 1: Listening 2: Leaf Active 3: Overriden Active Returns true if this Behavior is Inactive. |
boolean |
isLeaf()
A Behavior can be in one of four states: 0: Inactive 1: Listening 2: Leaf Active 3: Overriden Active Returns true if this Behavior is a Leaf. |
boolean |
isListening()
A Behavior can be in one of four states: 0: Inactive 1: Listening 2: Leaf Active 3: Overriden Active Returns true if this Behavior is Listening. |
boolean |
isOverriden()
A Behavior can be in one of four states: 0: Inactive 1: Listening 2: Leaf Active 3: Overriden Active Returns true if this Behavior is Overriden. |
protected void |
makeActive()
Changes the state of the Behavior to Leaf Active from a non-active state. If this bev is registered with a Behavior Coordinator (as it should be), it updates its state with the Coordinator. This method also climbs up the active behavioral tree, identifying the direct parent(s) up this behavior. |
protected void |
makeDeActive()
This method is called when a Behavior is transitioning from an Active state (leaf or overriden) to a Non-Active state (listening or inactive). |
protected void |
makeInactive()
Changes the state of the Behavior to Inactive. If this bev is registered with a Behavior Coordinator (as it should be), it updates its state with the Coordinator. |
protected void |
makeListening()
Changes the state of the Behavior to Listening. If this bev is registered with a Behavior Coordinator (as it should be), it updates its state with the Coordinator. |
protected void |
makeOverriden()
Changes the state of the Behavior to Overriden. If this bev is registered with a Behavior Coordinator (as it should be), it updates its state with the Coordinator. |
protected void |
makeUnOverriden()
Changes the state of the Behavior to UnOverriden.(i.e., from Overriden Active to Leaf Active) If this bev is registered with a Behavior Coordinator (as it should be), it updates its state with the Coordinator. |
protected Method |
nameToAction(String actionName)
Given the name of an Action in this Behavior, returns the Method object of the Action. |
void |
override(Vector actionNames)
What a child behavior would call to override specific actions of this behavior. |
void |
overrideAction(String actionName)
The BehaviorAgent itself calls this method to
mark an action as overriden. |
void |
pass(Secret secret)
What the BehaviorCoordinator calls to pass an
event (i.e., the Secret) to the Behavior. |
void |
registerBevCoord(AgentID aid)
How the BehaviorCoordinator registers itself with this Behavior. |
void |
removeChild(BehaviorID bID)
When a child behavior of this behavior becomes deactivated, it tells this bev, and this bev disconnects itself from the child. |
void |
removePermanentAction(String actionName)
Removes an action from the collection of Permanent Actions of this behavior. |
void |
setIDNumeric(Integer num)
How to set the numeric value of this Behavior's BehaviorID |
String |
showHashedAgentStubs()
Returns a String representation of the agentID-->agentStub mapping. |
void |
temporarilyActivateAction(String actionName)
For a given pass of a secret, a behavior can temporarily activate an action (that is overriden) in this action. |
void |
undoOverride(Vector actionNames)
What a child behavior would call to un-override specific actions of this behavior. |
protected void |
unOver()
Is called by actions to allow for the temporarily activation of all actions in all ancestor bevs that this action normally overrides. |
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, tell |
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 |
Methods inherited from interface agentland.util.Spy |
tell |
Constructor Detail |
public BehaviorAgent() throws RemoteException
BehaviorAgent
instance.super();
in the
subclass constructor.RemoteException
- if an error occursMethod Detail |
public BehaviorID getID()
getID
in interface Behavior
BehaviorID
valuepublic void setIDNumeric(Integer num) throws RemoteException
setIDNumeric
in interface Behavior
num
- an Integer
valueRemoteException
- if an error occursBehaviorID
public boolean isOverriden()
isOverriden
in interface Behavior
boolean
valuepublic boolean isLeaf()
isLeaf
in interface Behavior
boolean
valuepublic boolean isActive()
isActive
in interface Behavior
boolean
valuepublic boolean isListening()
isListening
in interface Behavior
boolean
valuepublic boolean isInactive()
isInactive
in interface Behavior
boolean
valueprotected void makeOverriden()
BehaviorCoordinator
protected void makeUnOverriden()
BehaviorCoordinator
protected void makeActive()
BehaviorCoordinator
protected void makeListening()
BehaviorCoordinator
protected void makeInactive()
BehaviorCoordinator
protected void makeDeActive()
pass(Secret secret)
public void addParent(BehaviorID bID) throws RemoteException
bID
.addParent
in interface Behavior
bID
- The BehaviorID
of the parentRemoteException
- if an error occurspublic void addChild(BehaviorID bID) throws RemoteException
addChild
in interface Behavior
bID
- the BehaviorID
of the child behaviorRemoteException
- if an error occurspublic void removeChild(BehaviorID bID) throws RemoteException
removeChild
in interface Behavior
bID
- a BehaviorID
valueRemoteException
- if an error occurspublic Vector getParents() throws RemoteException
getParents
in interface Behavior
Vector
containing the BehaviorIDs of the
parentsRemoteException
- if an error occurspublic Vector getActiveParents()
getDirectActiveParents()
,
which returns the parents that are at one level of hierarchy above this
bev (in the active behavioral tree).getActiveParents
in interface Behavior
Vector
containing the BehaviorIDs of the
parentsRemoteException
- if an error occursgetDirectActiveParents()
public Vector getDirectActiveParents()
getDirectActiveParents
in interface Behavior
Vector
containing the BehaviorIDs of the parentsgetChildren()
public Vector getChildren()
getChildren
in interface Behavior
Vector
containing the BehaviorIDs of the childrengetDirectActiveParents()
public void activateParent(BehaviorID bID)
activateParent
in interface Behavior
bID
- the BehaviorID
of the parent to be
activatedpublic void deactivateParent(BehaviorID bID)
deactivateParent
in interface Behavior
bID
- the BehaviorID
of the parent to be
deactivatedpublic void addActionDependency(BehaviorID parID, String thisAction, String parentAction) throws RemoteException
addActionDependency
in interface Behavior
parID
- the BehaviorID
of the parent behaviorthisAction
- the String
name of the action in
this behavior that is overridingparentAction
- the String
name of the action
in the parent behavior that is being overridenRemoteException
- if an error occurspublic void deleteActionDependency(BehaviorID parID, String thisAction, String parentAction) throws RemoteException
deleteActionDependency
in interface Behavior
parID
- the BehaviorID
of the parent behaviorthisAction
- the String
name of the action in
this behavior that is overridingparentAction
- the String
name of this action
in the parent behavior that is being overridenRemoteException
- if an error occurspublic Vector getOverridenActions()
getOverridenActions
in interface Behavior
Vector
of the names of the overriden
actions (as String
objects)RemoteException
- if an error occurspublic Vector getPermanentActions()
getPermanentActions
in interface Behavior
Vector
of the String names of the actionsaddPermanentAction(String actionName)
,
removePermanentAction(String actionName)
public Vector getEvents() throws RemoteException
getEvents
in interface Behavior
Vector
of events (notifications) as
String
RemoteException
- if an error occurspublic Vector getActivationEvents() throws RemoteException
getActivationEvents
in interface Behavior
Vector
of events (notifications) as
String
RemoteException
- if an error occurspublic Vector getAllEvents() throws RemoteException
getAllEvents
in interface Behavior
Vector
of events (notifications) as
String
RemoteException
- if an error occursprotected void addAction(Method action)
action
- the method to be called (i.e., the action) as a
Method
objectpublic void addPermanentAction(String actionName)
addPermanentAction
in interface Behavior
actionName
- a String
valuepublic void removePermanentAction(String actionName)
removePermanentAction
in interface Behavior
actionName
- a String
valueprotected void addEvent(String eventName, String actionName)
eventName
- the name of the notification as a String
actionName
- the name of an action that listens for this notification,
as a String
protected Method nameToAction(String actionName)
actionName
- the name of the Action, as a String
objectMethod
objectpublic void overrideAction(String actionName) throws RemoteException
BehaviorAgent
itself calls this method to
mark an action as overriden. I should probably make this a
private / protected method.overrideAction
in interface Behavior
actionName
- the name of the action to be overridenRemoteException
- if an error occurspublic void activateAction(String actionName) throws RemoteException
BehaviorAgent
itself calls this method to
restore an overriden action. I should probably make this a
private / protected method.activateAction
in interface Behavior
actionName
- a String
valueRemoteException
- if an error occurspublic void temporarilyActivateAction(String actionName)
temporarilyActivateAction
in interface Behavior
actionName
- the name of the action to temporarily activate,
as a String
getTemporarilyActiveActions()
public void override(Vector actionNames) throws RemoteException
override
in interface Behavior
actionNames
- a Vector
containing the names
of the actions that the child behavior wants to override. Each
name is a String
object.RemoteException
- if an error occurspublic void undoOverride(Vector actionNames) throws RemoteException
undoOverride
in interface Behavior
actionNames
- a Vector
containing the names
of the actions that the child behavior wants to restore. Each
name is a String
object.RemoteException
- if an error occurspublic void activate(Secret secret)
BehaviorAgent
-- this method only
logs an error message.secret
- the Secret
that gets passed to the
Behavior.public void pass(Secret secret) throws RemoteException
BehaviorCoordinator
calls to pass an
event (i.e., the Secret) to the Behavior. This method in turn
calls all the actions of this Behavior.pass
in interface Behavior
secret
- the Secret
that gets passedRemoteException
- if an error occursBehaviorCoordinator
public String getName() throws RemoteException
BehaviorID
.getName
in interface Behavior
RemoteException
- if an error occurspublic String getDependencies(BehaviorID parID) throws RemoteException
parID
that this behavior overrides.getDependencies
in interface Behavior
parID
- the BehaviorID
of the parentString
RemoteException
- if an error occurspublic String getDependencies() throws RemoteException
getDependencies
in interface Behavior
String
RemoteException
- if an error occurspublic void registerBevCoord(AgentID aid) throws RemoteException
registerBevCoord
in interface Behavior
aid
- the AgentID
of the BehaviorCoordinatorRemoteException
- if an error occursprotected void unOver()
super()
call in Java, but
this analogy doesn't go very far. unOver() doesn't immediately call
the action in the ancestor; the temporarily activated action is called
when that behavior has the secret. So you can't embed the unOver() call
as you would a super() call. Also, unOver() temporarily activates ALL
actions (in ALL bevs) that the current action overrides. (But note that
even if this action temporarily activates another action, if other
actions still override the actions, it still won't be fired.)public String showHashedAgentStubs()
showHashedAgentStubs
in interface Behavior
String
representation
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |