|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.openai.ai.ga.population.PopulationArray
The PopulationArray is the equilivant of an array of Population
elements. This offers the advantage of dynamicism in size and in adding
and removing elements from the collection.
| Field Summary | |
protected java.util.Collection |
pops
The Collection that holds all the Populations |
| Constructor Summary | |
PopulationArray()
Creates a PopulationArray using an ArrayList |
|
PopulationArray(java.util.Collection initialCollection)
Creates a PopulationArray with a given initial
Collection |
|
PopulationArray(PopulationArray toClone)
Creates a shallow clone of the passed PopulationArray. |
|
| Method Summary | |
void |
addPopulation(Population toAdd)
Adds a Population to this PopulationArray. |
void |
addPopulations(PopulationArray toAdd)
Adds all the Populations in the given
PopulationArray. |
void |
cleanse()
Removes non- Population objects from the
Collection |
Population[] |
getPopulationArray()
Returns a Population[] array representing all the
Populations in this population array. |
java.util.Iterator |
getPopulationIterator()
Returns an Iterator to be used to iterate through all the
Populations in this PopulationArray. |
java.util.Collection |
getPopulations()
Returns a Collection representing the internal
representation of the PopulationArray |
int |
getSize()
Returns the number of Populations in this
PopulationArrays. |
void |
removeAllSameAs(Population toRemove)
Removes all instances of Population from this
PopulationArray. |
boolean |
removePopulation(Population toRemove)
Removes a Population from this PopulationArray
. |
void |
removePopulations(PopulationArray toRemove)
Removes a group of Populations from this
PopulationArray. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.util.Collection pops
Collection that holds all the Populations| Constructor Detail |
public PopulationArray()
PopulationArray using an ArrayListpublic PopulationArray(java.util.Collection initialCollection)
PopulationArray with a given initial
CollectioninitialCollection - the Collection to initialize topublic PopulationArray(PopulationArray toClone)
PopulationArray.
This is not a complete clone, in which each of the Population
s would also be cloned; this instead creates a copy of the
list of Populations to which additions and removals
do not affect the original population.| Method Detail |
public void addPopulation(Population toAdd)
Population to this PopulationArray.
Does nothing when given null.toAdd - the Population to addpublic void addPopulations(PopulationArray toAdd)
Populations in the given
PopulationArray. Does nothing on null or an
empty PopulationArray.toAdd - the PopulationArray to addpublic boolean removePopulation(Population toRemove)
Population from this PopulationArray
. Returns whether the removal was successful or not. Returns
true when given a null.toRemove - the Cell to removetrue on success;false otherwisepublic void removePopulations(PopulationArray toRemove)
Populations from this
PopulationArray. Does not indicate whether the removal was
successful or not. Does nothing when given a null or an
empty Population. Does not throw
ArrayIndexOutOfBoundsException.toRemove - the PopulationArray to removepublic void removeAllSameAs(Population toRemove)
Population from this
PopulationArray. Does not indicate whether any removal took
place. Does nothing when given a null or a non-existant
Population.toRemove - the PopulationArray to removepublic Population[] getPopulationArray()
Population[] array representing all the
Populations in this population array. Returns an empty
array when empty.Population[] of all Populationspublic java.util.Collection getPopulations()
Collection representing the internal
representation of the PopulationArrayPopulation[] of all Populationspublic int getSize()
Populations in this
PopulationArrays.Populationspublic java.util.Iterator getPopulationIterator()
Populations in this PopulationArray.Iterator on the Population
collectionpublic void cleanse()
Population objects from the
Collectionpublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||