|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlio.population.Population
lio.population.VariablePopulation
public class VariablePopulation
Field Summary |
---|
Fields inherited from class lio.population.Population |
---|
size |
Constructor Summary | |
---|---|
VariablePopulation()
Constructor |
|
VariablePopulation(Individual[] individuals)
Constructor Encapsulates an array of individuals into a VariablePopulation. |
|
VariablePopulation(int pNumPositions)
Constructor The parameter pNumPositions is provided for efficiency and must be the maximum size estimated. |
Method Summary | |
---|---|
void |
addElement(Individual individual)
Append the specified individual to the end of the population |
void |
compress()
Deletes all empty positions of the population. |
Individual |
elementAt(int position)
Returns a reference to the individual in the given position. |
int |
getNumPositions()
|
Individual[] |
individuals()
Returns an array containing all individuals, but not empty spaces. |
void |
remove(int position)
Removes an element of the population given its position. |
void |
removeElementAt(int position,
boolean keepPosition)
Removes an element of the population given its position. |
void |
setElementAt(int position,
Individual individual)
Replaces the element at given position. |
Methods inherited from class lio.population.Population |
---|
copyElementAt, size |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VariablePopulation()
public VariablePopulation(int pNumPositions)
pNumPositions
- Maximum estimated size of the Array containing the individuals.public VariablePopulation(Individual[] individuals)
individuals
- Array of individuals that will form the population.Method Detail |
---|
public Individual elementAt(int position)
elementAt
in class Population
position
- Individual that is referenced.
public void removeElementAt(int position, boolean keepPosition)
position
- Position of the element to remove.keepPosition
- Tells whether indexes in the population must be keptpublic void remove(int position)
position
- Position of the element to remove.public void addElement(Individual individual)
individual
- new individual to be addedpublic void setElementAt(int position, Individual individual)
setElementAt
in class Population
position
- Position where the individual will be placed.individual
- Individual to be stored at the population.public Individual[] individuals()
individuals
in class Population
public void compress()
public int getNumPositions()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |