Package org.opt4j.core
Class IndividualSet
java.lang.Object
org.opt4j.core.IndividualSet
- All Implemented Interfaces:
Iterable<Individual>,Collection<Individual>,Set<Individual>
- Direct Known Subclasses:
Archive,Population
The
IndividualSet is a Set of Individuals. It allows
to add and remove listeners, see IndividualSetListener.- See Also:
-
optimizer.Archiveoptimizer.Population
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Set<Individual>protected final Set<IndividualSetListener> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(Individual individual) booleanaddAll(Collection<? extends Individual> c) booleanaddAll(Individual... c) Add allIndividuals.voidaddListener(IndividualSetListener listener) Adds a listener.voidclear()booleanbooleancontainsAll(Collection<?> c) booleanisEmpty()iterator()booleanbooleanremoveAll(Collection<?> c) voidremoveListener(IndividualSetListener listener) Removes a listener.booleanretainAll(Collection<?> c) intsize()Object[]toArray()<T> T[]toArray(T[] a) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
equals, hashCode, spliterator
-
Field Details
-
individuals
-
listeners
-
-
Constructor Details
-
IndividualSet
public IndividualSet()
-
-
Method Details
-
add
- Specified by:
addin interfaceCollection<Individual>- Specified by:
addin interfaceSet<Individual>
-
iterator
- Specified by:
iteratorin interfaceCollection<Individual>- Specified by:
iteratorin interfaceIterable<Individual>- Specified by:
iteratorin interfaceSet<Individual>
-
size
public int size()- Specified by:
sizein interfaceCollection<Individual>- Specified by:
sizein interfaceSet<Individual>
-
addListener
Adds a listener.- Parameters:
listener- the added listener- See Also:
-
removeListener
Removes a listener.- Parameters:
listener- the removed listener- See Also:
-
clear
public void clear()- Specified by:
clearin interfaceCollection<Individual>- Specified by:
clearin interfaceSet<Individual>
-
addAll
- Specified by:
addAllin interfaceCollection<Individual>- Specified by:
addAllin interfaceSet<Individual>
-
addAll
Add allIndividuals.- Parameters:
c- the individuals to be added- Returns:
- true if at least one individual was added
-
contains
- Specified by:
containsin interfaceCollection<Individual>- Specified by:
containsin interfaceSet<Individual>
-
containsAll
- Specified by:
containsAllin interfaceCollection<Individual>- Specified by:
containsAllin interfaceSet<Individual>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<Individual>- Specified by:
isEmptyin interfaceSet<Individual>
-
remove
- Specified by:
removein interfaceCollection<Individual>- Specified by:
removein interfaceSet<Individual>
-
removeAll
- Specified by:
removeAllin interfaceCollection<Individual>- Specified by:
removeAllin interfaceSet<Individual>
-
retainAll
- Specified by:
retainAllin interfaceCollection<Individual>- Specified by:
retainAllin interfaceSet<Individual>
-
toArray
- Specified by:
toArrayin interfaceCollection<Individual>- Specified by:
toArrayin interfaceSet<Individual>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArrayin interfaceCollection<Individual>- Specified by:
toArrayin interfaceSet<Individual>
-