|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--elge.agent.Agent | +--elge.agent.AgentContainer
AgentContainer is extended Agent class so, it can hold other agents. It registres itself to its agency, and every added agent has the same agency. Also the life cycle of the AgentContainer is changed.
Ii firstly runs it own life method, and than it calls life method of every agent included in it.
This structure is for making the agents as a group of smaller agents. For example an agent can consist of agents like memory, spectator, action_chooser and so on. Then only change of the one agent can change the whole behavior.
Field Summary | |
protected AgentRepresentation |
agents
This is where the agents are stored. |
protected Agency |
innerAgency
InnerAgency is used for the agents included in the container. |
Fields inherited from class elge.agent.Agent |
actualSituation, agency, agencyClass, agentClassCounter, id, name, registered |
Constructor Summary | |
AgentContainer()
Creates a new instance of AgentContainer |
|
AgentContainer(Agency agency)
Creates a new instance of AgentContainer with agency. |
|
AgentContainer(Agent agent)
Create new instance and adds one Agent to the agent container |
|
AgentContainer(AgentContainer agentContainer)
Create new instance from another AgentContainer. |
|
AgentContainer(String name)
Creates a new instance of AgentContainer with a name. |
|
AgentContainer(String name,
Agency agency)
Creates a new instance of AgentContainer with name and agency |
|
AgentContainer(String name,
Agency agency,
Agency innerAgency)
Creates a new instance of AgentContainer with name, agency and inner agency to use. |
|
AgentContainer(String name,
Agency agency,
Agency innerAgency,
AgentRepresentation wr)
Creates a new instance of AgentContainer with name, agency, inner agency and world representaion |
|
AgentContainer(Vector agents)
Create new instance and Agents from the vector includes in. |
Method Summary | |
void |
add(Agent agent)
adds an agent to the system and sets it the agency. |
void |
add(Enumeration agents)
add agents contained in the enumeration. |
void |
add(Iterator agents)
add agents contained in the iterator. |
void |
agentsLife()
This method runs the life method of all agents inside the container. |
void |
del(Agent agent)
removes the agent from the container. |
int |
getAgentCount()
Returns the number of Agents in the AgentContainer |
AgentRepresentation |
getAgents()
use this method to get the agents from this container. |
void |
life()
The life cycle of the AgentContainer is different, because it should handle the angents it sonsist of, and not himeself (but yo may want to do this anyway). |
void |
setAgents(AgentRepresentation lt)
Sets AgentRepresentation to this container. |
Methods inherited from class elge.agent.Agent |
ask, ask, ask, createDefaultAgency, createUniqueID, getAgency, getFullName, getID, getName, chooseAction, init, life, memorize, restart, sense, setAgency, setAgency, setAgency, setID, setName, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Agency innerAgency
protected AgentRepresentation agents
Constructor Detail |
public AgentContainer()
public AgentContainer(String name)
name
- name of the agent.public AgentContainer(Agency agency)
agency
- agency to use.public AgentContainer(String name, Agency agency)
name
- name of the agentagency
- agency to usepublic AgentContainer(String name, Agency agency, Agency innerAgency)
name
- name of the agentagency
- agency to use.innerAgency
- agency to use for included agentspublic AgentContainer(String name, Agency agency, Agency innerAgency, AgentRepresentation wr)
name
- name fo the agentagency
- agency to useinnerAgency
- agency to use for included agentswr
- AgentRepresentation to use for the agents storage.public AgentContainer(Vector agents)
agents
- Vector of Agentspublic AgentContainer(Agent agent)
agent
- an Agentpublic AgentContainer(AgentContainer agentContainer)
agentContainer
- an AgentContainerMethod Detail |
public void add(Agent agent)
agent
- agent to addpublic void del(Agent agent)
agent
- agent to removepublic void add(Iterator agents)
agents
- iteration of agents.public void add(Enumeration agents)
agents
- enumeration of agents.public AgentRepresentation getAgents()
public void setAgents(AgentRepresentation lt)
lt
- the AgentRepresentation. Can contain agents..public int getAgentCount()
Agents
in the AgentContainer
public void life()
life
in class Agent
public void agentsLife()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |