public class AgentList extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected org.springframework.beans.factory.ObjectFactory<Agent> |
agentFactory |
protected List<Agent> |
agents
The agents comprising this list.
|
static Comparator<Agent> |
ascendingFitnessComparator |
static Comparator<Agent> |
descendingFitnessComparator |
protected int |
size |
Constructor and Description |
---|
AgentList()
Create an empty AgentList.
|
AgentList(Agent agent)
Create a list comprising a single agent.
|
AgentList(ArrayList<AgentList> lists)
Create an AgentList by merging a list of AgentList objects.
|
AgentList(Collection<Agent> agents)
Create an AgentList from the supplied Collection of agents.
|
AgentList(int size)
Create an empty AgentList with the specified capacity.
|
AgentList(int size,
org.springframework.beans.factory.ObjectFactory<Agent> agentFactory)
Create an AgentList by manufacturing objects from the supplied
factory.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Agent agent) |
boolean |
addAll(Collection<? extends Agent> c) |
Agent |
get(int i) |
org.springframework.beans.factory.ObjectFactory<Agent> |
getAgentFactory() |
List<Agent> |
getAgents() |
double |
getMaxFitness() |
int |
getSize() |
double |
getTotalFitness() |
Iterator<Agent> |
iterator() |
void |
populateFromFactory() |
Agent |
remove(int index) |
void |
set(int i,
Agent agent) |
void |
setAgentFactory(org.springframework.beans.factory.ObjectFactory<Agent> agentFactory) |
void |
setAgents(List<Agent> agents) |
void |
setSize(int size) |
void |
shuffle(cern.jet.random.engine.RandomEngine prng)
Randomly sort the agents in this list.
|
int |
size() |
void |
sortAgents(Comparator<Agent> comparator) |
void |
sortAgentsByFitness() |
protected int size
protected org.springframework.beans.factory.ObjectFactory<Agent> agentFactory
public static final Comparator<Agent> ascendingFitnessComparator
public static final Comparator<Agent> descendingFitnessComparator
public AgentList(int size)
size
- public AgentList()
public AgentList(Agent agent)
agent
- public AgentList(Collection<Agent> agents)
agents
- public AgentList(ArrayList<AgentList> lists)
lists
- An ArrayList holding an array of AgentList objects.public AgentList(int size, org.springframework.beans.factory.ObjectFactory<Agent> agentFactory)
size
- The number of agents to manufacture.agentFactory
- The factory used to manufacture agents.public void populateFromFactory()
public Agent get(int i)
public void set(int i, Agent agent)
public void add(Agent agent)
public boolean addAll(Collection<? extends Agent> c)
public Agent remove(int index)
public int size()
public double getTotalFitness()
public double getMaxFitness()
public void shuffle(cern.jet.random.engine.RandomEngine prng)
prng
- public void sortAgentsByFitness()
public void sortAgents(Comparator<Agent> comparator)
public int getSize()
public void setSize(int size)
public org.springframework.beans.factory.ObjectFactory<Agent> getAgentFactory()
public void setAgentFactory(org.springframework.beans.factory.ObjectFactory<Agent> agentFactory)
Copyright © 2014. All rights reserved.