|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Relationships are the life-blood of the RELATE architecture.
One of the most important aspects of a Java class that implements the Relationship interface is that it must have a no-argument constructor. As described above, this allows the RelationshipManager to create it dynamically to verify prerequisites and assign members. Relationships have a conditionsMaintained() method that is used by the RelationshipManager to verify prerequisites are met prior to creating the relationship. Once created by the RelationshipManager, the Relationship objects are independent agents that issue roles to each member agent using the issueRoles() method. They also monitor conditions of, their members. They also destroy themselves if minimum requirements for existence are not maintained using the method destroyRelationship(). When this happens, the relationship withdrawals all of its associated Role objects from each member, then removes itself from the RelationshipManager's active relationship vector.
See the RelationshipManager class for more details on how relationships interact with the RelationshipManager.
Method Summary | |
boolean |
addAgent(Agent pAgent)
Adds the passed in agent to the list of members of this relationship. |
boolean |
conditionsMaintained()
Verifies conditions are maintained to continue this relationship. |
boolean |
conditionsMet(Agent pAgent,
java.util.Vector pSensedAgents)
Verifies conditions are met to form this relationship. |
void |
destroyRelationship()
When conditions are no longer met to maintain this relationship, this method is called. |
java.lang.String |
getClassName()
Returns The class name of this relationship. |
int |
getIDNumber()
Returns the ID number of this relationship. |
java.util.Vector |
getMembers()
Returns the vector of members currently in this relationship |
void |
issueRoles()
Issues the appropriate roles to each member in the relationship. |
boolean |
removeAgent(Agent pAgent)
Removes the passed in agent from the list of members of this relationship. |
void |
setClassName(java.lang.String pClassName)
Sets the class name of this relationship |
void |
setIDNumber(int pID)
Sets the ID number of this relationship |
java.lang.String |
toString()
Returns a formated description of this relationship suitable for printing |
Method Detail |
public boolean conditionsMet(Agent pAgent, java.util.Vector pSensedAgents)
pAgent
- The agent attempting to form the relationshippSensedAgents
- A vector containing all of the sensed agents
public boolean conditionsMaintained()
public void destroyRelationship()
public void issueRoles()
public boolean addAgent(Agent pAgent)
pAgent
- The agent to be added to this relationship.
public boolean removeAgent(Agent pAgent)
pAgent
- The agent to be removed from this relationship.
public int getIDNumber()
public void setIDNumber(int pID)
pID
- The new ID numberpublic void setClassName(java.lang.String pClassName)
pClassName
- The new class namepublic java.lang.String getClassName()
public java.util.Vector getMembers()
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |