neosim.implementation
Class PopulationImpl

java.lang.Object
  |
  +--neosim.implementation.PopulationNodeImpl
        |
        +--neosim.implementation.PopulationImpl
Direct Known Subclasses:
PopulationBuilderImpl, PopulationViewImpl

public class PopulationImpl
extends PopulationNodeImpl
implements Population

A population is a collection of one or more entity handles. It can contain extra methods for initialising the elements of the population, or for indexing them rapidly.

See Also:
Serialized Form

Constructor Summary
PopulationImpl(java.lang.String name, PopulationNode parent, int size)
           
 
Method Summary
 void addLocalMember(Entity e)
          Add a local member to this population (kernel method)
 void addMember(EntityID e)
          Add a member to this population
 EntityID getEntityID(int i)
          return index of a given entity handle
 int getID()
          Return unique population id
 int getIndex(EntityID eid)
          return index of a given entity handle
 java.util.Vector getLocalMembers()
          Add a local member to this population (kernel method)
 java.util.Vector getMemberList()
          Return a list of all members
 int getNumEnts()
          Return number of entities
 boolean isLeaf()
          Return true if this is a leaf node
 boolean isMember(EntityID eid)
          return whether a given entity is a member
 
Methods inherited from class neosim.implementation.PopulationNodeImpl
getName, getParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PopulationImpl

public PopulationImpl(java.lang.String name,
                      PopulationNode parent,
                      int size)
Method Detail

getID

public int getID()
Return unique population id
Specified by:
getID in interface Population

getNumEnts

public int getNumEnts()
Return number of entities
Specified by:
getNumEnts in interface Population

getIndex

public int getIndex(EntityID eid)
return index of a given entity handle
Specified by:
getIndex in interface Population
Parameters:
eid - handle of entity
Returns:
index of entity in population if present, or -1 otherwise.

getEntityID

public EntityID getEntityID(int i)
return index of a given entity handle
Specified by:
getEntityID in interface Population
Parameters:
i - index in population
Returns:
handle of entity

isMember

public boolean isMember(EntityID eid)
return whether a given entity is a member
Specified by:
isMember in interface Population
Parameters:
eid - handle of entity
Returns:
true if entity is a member of this population

addMember

public void addMember(EntityID e)
Add a member to this population
Specified by:
addMember in interface Population
Parameters:
eid - handle of entity

getMemberList

public java.util.Vector getMemberList()
Return a list of all members
Specified by:
getMemberList in interface Population

isLeaf

public boolean isLeaf()
Description copied from interface: PopulationNode
Return true if this is a leaf node

addLocalMember

public void addLocalMember(Entity e)
Add a local member to this population (kernel method)
Parameters:
e - entity to add

getLocalMembers

public java.util.Vector getLocalMembers()
Add a local member to this population (kernel method)
Returns:
the vector of lcoal entities