Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Individuals.Populations
Class SimplePopulation

    java.lang.Object
      Individuals.Populations.SimplePopulation

All Implemented Interfaces:
  Population

    public class SimplePopulation

extends java.lang.Object
implements Population

Population using an array list structure for storing the individuals. The functions are wrappers for the ArrayList structure.

Author:
  Conor

Constructor Summary
`SimplePopulation()` Creates a new instance of SimplePopulation
`SimplePopulation(int size)`

Method Summary
`void` | `add(Individual i)` Add an individual to the population
`void` | `addAll(java.util.Collection<Individual> immigrants)` Add a collection of individuals to the population
`void` | `addAll(Population immigrants)` Add an entire population to the population
`void` | `clear()` Clear the population of all individuals
`boolean` | `contains(AbstractIndividual individual)`
`boolean` | `contains(Individual individual)` Check if the individual is contained in the population
`Individual` | `get(int index)` Get an individual from the specified index
`java.util.List<Individual>` | `getAll()` Get a list of all the individuals
`java.util.Iterator<Individual>` | `iterator()` Get an iterator over the population
`void` | `remove(Individual ind)` Remove individual from population
`Individual` | `set(int i, Individual ind)`
`int` | `size()` The number of individuals in the population
`void` | `sort()` Sort the individuals in the population
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### SimplePopulation

    public SimplePopulation()

  Creates a new instance of SimplePopulation

### SimplePopulation

    public SimplePopulation(int size)

Method Detail

### add

    public void add(Individual i)

  Description copied from interface: `Population`
  Add an individual to the population

  Specified by:
    `add` in interface `Population`
  Parameters:
    `i` - individual to add

### sort

    public void sort()

  Description copied from interface: `Population`
  Sort the individuals in the population

  Specified by:
    `sort` in interface `Population`

### iterator

    public java.util.Iterator<Individual> iterator()

  Description copied from interface: `Population`
  Get an iterator over the population

  Specified by:
    `iterator` in interface `Population`
  Returns:
    iterator over the Individuals

### size

    public int size()

  Description copied from interface: `Population`
  The number of individuals in the population

  Specified by:
    `size` in interface `Population`
  Returns:
    number of individuals

### addAll

    public void addAll(java.util.Collection<Individual> immigrants)

  Description copied from interface: `Population`
  Add a collection of individuals to the population

  Specified by:
    `addAll` in interface `Population`
  Parameters:
    `immigrants` - collection of individuals

### addAll

    public void addAll(Population immigrants)

  Description copied from interface: `Population`
  Add an entire population to the population

  Specified by:
    `addAll` in interface `Population`
  Parameters:
    `immigrants` - population to add

### getAll

    public java.util.List<Individual> getAll()

  Description copied from interface: `Population`
  Get a list of all the individuals

  Specified by:
    `getAll` in interface `Population`
  Returns:
    list view of the population

### contains

    public boolean contains(AbstractIndividual individual)

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### contains

    public boolean contains(Individual individual)

  Description copied from interface: `Population`
  Check if the individual is contained in the population

  Specified by:
    `contains` in interface `Population`
  Parameters:
    `individual` - individual to compare
  Returns:
    boolean value if the individual exists in the population

### get

    public Individual get(int index)

  Description copied from interface: `Population`
  Get an individual from the specified index

  Specified by:
    `get` in interface `Population`
  Parameters:
    `index` - which individual to return
  Returns:
    individual at index

### clear

    public void clear()

  Description copied from interface: `Population`
  Clear the population of all individuals

  Specified by:
    `clear` in interface `Population`

### remove

    public void remove(Individual ind)

  Description copied from interface: `Population`
  Remove individual from population

  Specified by:
    `remove` in interface `Population`
  Parameters:
    `ind` - individual to remove

### set

    public Individual set(int i,
                          Individual ind)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD