|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmil.navy.nps.relate.Thing
mil.navy.nps.relate.Agent
This abstract class implements the RELATE Agent.
Since all Agents are objects, or things, Agent extends Thing, giving it the ability to update and draw itself. By the definition:
To satisfy these requirements, the developer must first establish a method for the agent to gather information about the environment it exists in. This information is stored in the sensedEnvironment data member. This class allows the developer to do this by defining the abstract getSensedEnvironment() and setSensedEnvironment() methods to interact with the simulation environment directly. These methods should utilize the sensorList hashtable to define what each agent is capable of sensing, and only allow the agent to sense the specific attributes of the environment that its current sensor list can detect or discern.
Next, the agent must select an appropriate action. Two things are needed for this: actions that can be selected, and a method or methods to select these actions. The actions each agent can take are simulation-dependent and must be defined by the developer. For simpler simulations, actions can be built into the Agent class itself. An Action interface is provided as a tool for the developer designing more complex simulations. The mechanism for selecting actions is based upon the relationships each agent forms, and the associated roles and goals that the agent attempts to fulfill.
Agents have a relationship hashtable that the developer must fill with the class names of all the potential relationships that the agent can form. This can be accomplished by using the addRelationshipName() method.
Field Summary | |
RelationshipManager |
relationshipManager
A "singleton" object that handles all relationships for this agent. |
Fields inherited from class mil.navy.nps.relate.Thing |
entityID, entityName |
Constructor Summary | |
Agent(long pID,
java.lang.String pName)
Constructor for this Agent |
Method Summary | |
void |
addRelationshipName(java.lang.String pRelationshipName)
Adds the passed in class name of the relationship in question. |
void |
addRelationshipNames(java.util.Vector pRelationshipNames)
Adds the passed in class name vector of the agents possible relationships. |
void |
addRole(Role pRole)
Adds the passed in role to the role vector. |
abstract void |
assignCredit()
Assigns credit to current goal set. |
void |
checkForRelationships()
checkForRelationships() calls the relationshipManagers method of the same name. |
Goal |
getActiveGoal()
Gets the active goal object. |
Role |
getActiveRole()
Gets the active role object. |
long |
getAgentID()
Gets the Agent's ID by using the super's getEntityID method |
java.lang.String |
getAgentName()
Gets the Agent's name by using the super's getEntityName method |
java.util.Hashtable |
getGoalList()
Gets the Agent's goalList |
Goal |
getPastActiveGoal()
Gets the Agents past active goal |
Personality |
getPersonality()
Gets the Agent's personality |
java.util.Hashtable |
getRelationshipTable()
Gets the Agent's relationship Hashtable |
java.util.Vector |
getRoleVector()
Gets the Agent's role vector |
abstract SensedEnvironment |
getSensedEnvironment()
Gets the SensedEnvironment. |
java.util.Hashtable |
getSensorList()
Gets the Agent's sensorList |
void |
removeRelationshipName(java.lang.String pRelationshipName)
Removes the associated relationship corresponding to the passed in relationship class name from the relationship hashtable. |
boolean |
removeRole(Role pRole)
Removes the passed in role from the role vector. |
void |
setActiveGoal(Goal pGoal)
Sets the active goal |
protected void |
setAgentID(long pID)
Sets the Agent's ID by using the super's setEntityID method |
protected void |
setAgentName(java.lang.String pAgentName)
Sets the Agent's name by using the super's SetEntityName method |
void |
setPastActiveGoal(Goal pGoal)
Sets the Agents past active goal |
void |
setPersonality(Personality pPersonality)
Sets the Agent's personality |
abstract void |
setSensedEnvironment(SensedEnvironment pPEnv)
Sets the agents SensedEnvironment to the passed in object |
void |
setSensorList(java.util.Hashtable pSensorList)
Sets the Agent's sensorList |
Methods inherited from class mil.navy.nps.relate.Thing |
drawSelf, getEntityID, getEntityName, setEntityID, setEntityName, step |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public RelationshipManager relationshipManager
Constructor Detail |
public Agent(long pID, java.lang.String pName)
Method Detail |
public abstract SensedEnvironment getSensedEnvironment()
public abstract void setSensedEnvironment(SensedEnvironment pPEnv)
public abstract void assignCredit()
public void addRelationshipName(java.lang.String pRelationshipName)
public void addRelationshipNames(java.util.Vector pRelationshipNames)
public void removeRelationshipName(java.lang.String pRelationshipName)
public void addRole(Role pRole)
pRole
- The new Role being assignedpublic boolean removeRole(Role pRole)
pRole
- The Role that is to be removed
public void checkForRelationships()
public Role getActiveRole()
public Goal getActiveGoal()
public void setActiveGoal(Goal pGoal)
pGoal
- The Agents new active goal.public Goal getPastActiveGoal()
public void setPastActiveGoal(Goal pGoal)
pGoal
- The Agent's past active goal.public java.util.Hashtable getGoalList()
public java.util.Hashtable getSensorList()
public void setSensorList(java.util.Hashtable pSensorList)
pSensorList
- public long getAgentID()
protected void setAgentID(long pID)
public Personality getPersonality()
public void setPersonality(Personality pPersonality)
public java.util.Hashtable getRelationshipTable()
public java.lang.String getAgentName()
protected void setAgentName(java.lang.String pAgentName)
public java.util.Vector getRoleVector()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |