elge.world
Class AgentGenerator

java.lang.Object
  |
  +--elge.agent.Agent
        |
        +--elge.agent.AgentContainer
              |
              +--elge.world.WorldAgent
                    |
                    +--elge.world.AbstractGenerator
                          |
                          +--elge.world.AgentGenerator
All Implemented Interfaces:
MoveableAgent

public class AgentGenerator
extends AbstractGenerator

This agent is a generator of agent in a world. It has some parameters for generating some type of agent. Than it is put into a world, where it can generate agents. There is also some degenerator :) or agent deleter :) to be made. Or everything is done by this agent?

Author:
Pavol Žibrita

Field Summary
static int ABS_POS
           
static int FIX_POS
           
static int REL_POS
           
static String[] rndPositionTypes
           
 
Fields inherited from class elge.world.AbstractGenerator
EXACT_GEN, FIRST_GEN, genCycleTypes, NO_GEN, PERIOD_GEN, TICK_GEN
 
Fields inherited from class elge.agent.AgentContainer
agents, innerAgency
 
Fields inherited from class elge.agent.Agent
actualSituation, agency, agencyClass, agentClassCounter, id, name, registered
 
Fields inherited from interface elge.world.MoveableAgent
PROP_POSITION
 
Constructor Summary
AgentGenerator()
          Creates a new instance of AgentGenerator
 
Method Summary
protected  void agentAction()
          define this method to generate, remove or whatevery you need to do.
protected  Point createPosition()
          This method should return a position for the new agent.
protected  void generateAgent()
           
protected  void generateAgent(int num)
          Generates an agent from the template and then puts it in the system...
 WorldAgent getAgentTemplate()
           
 int getGeneratedAgentsCount()
          How many agents were generated by now.
 int getMaxAgents()
           
 ComboInteger getRndPosition()
           
 double getRndRadius()
           
 void init()
          To do some initialization?
 void restart()
          This method performs restarting the agent.
 void setAgentTemplate(WorldAgent ct)
          The agent template, that should be generated...
 void setMaxAgents(int num)
          How many agents to be generated.
 void setRndPosition(ComboInteger ci)
           
 void setRndRadius(double r)
           
 
Methods inherited from class elge.world.AbstractGenerator
getGenCycleType, getGenPeriod, getGenProb, getInOneStep, chooseAction, isGenerator, setGenCycleType, setGenPeriod, setGenProb, setInOneStep
 
Methods inherited from class elge.world.WorldAgent
addVetoableChangeListener, getFullName, getGenerated, getGroup, getHidden, getPosition, paint, removeVetoableChangeListener, setGenerated, setGroup, setHidden, setPosition
 
Methods inherited from class elge.agent.AgentContainer
add, add, add, agentsLife, del, getAgentCount, getAgents, life, setAgents
 
Methods inherited from class elge.agent.Agent
ask, ask, ask, createDefaultAgency, createUniqueID, getAgency, getID, getName, life, memorize, 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

ABS_POS

public static final int ABS_POS
See Also:
Constant Field Values

REL_POS

public static final int REL_POS
See Also:
Constant Field Values

FIX_POS

public static final int FIX_POS
See Also:
Constant Field Values

rndPositionTypes

public static final String[] rndPositionTypes
Constructor Detail

AgentGenerator

public AgentGenerator()
Creates a new instance of AgentGenerator

Method Detail

setMaxAgents

public void setMaxAgents(int num)
How many agents to be generated. Well, this is something like the max value. If you set it to -1, you can generate unlimited number of agents.


getMaxAgents

public int getMaxAgents()

getRndRadius

public double getRndRadius()

setRndRadius

public void setRndRadius(double r)

getRndPosition

public ComboInteger getRndPosition()

setRndPosition

public void setRndPosition(ComboInteger ci)

setAgentTemplate

public void setAgentTemplate(WorldAgent ct)
The agent template, that should be generated...


getAgentTemplate

public WorldAgent getAgentTemplate()

getGeneratedAgentsCount

public int getGeneratedAgentsCount()
How many agents were generated by now.


init

public void init()
To do some initialization?

Overrides:
init in class Agent

agentAction

protected void agentAction()
Description copied from class: AbstractGenerator
define this method to generate, remove or whatevery you need to do.

Specified by:
agentAction in class AbstractGenerator

generateAgent

protected void generateAgent(int num)
Generates an agent from the template and then puts it in the system...

Parameters:
num - how many agents to generate on one run

generateAgent

protected void generateAgent()

createPosition

protected Point createPosition()
This method should return a position for the new agent. The position should be generated by the AgentRepresentation object...


restart

public void restart()
Description copied from class: Agent
This method performs restarting the agent. It should restart what wver it needs, like some counter, memory and so. A brand new simulation should be runned with it !

Overrides:
restart in class Agent