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
public class IndividualSet extends Object implements Set<Individual>
TheIndividualSetis aSetofIndividuals. It allows to add and remove listeners, seeIndividualSetListener.- See Also:
optimizer.Archive,optimizer.Population
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<Individual>individualsprotected Set<IndividualSetListener>listeners
-
Constructor Summary
Constructors Constructor Description IndividualSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(Individual individual)booleanaddAll(Collection<? extends Individual> c)booleanaddAll(Individual... c)Add allIndividuals.voidaddListener(IndividualSetListener listener)Adds a listener.voidclear()booleancontains(Object o)booleancontainsAll(Collection<?> c)booleanisEmpty()Iterator<Individual>iterator()booleanremove(Object o)booleanremoveAll(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, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
equals, hashCode, spliterator
-
-
-
-
Field Detail
-
individuals
protected final Set<Individual> individuals
-
listeners
protected final Set<IndividualSetListener> listeners
-
-
Method Detail
-
add
public boolean add(Individual individual)
- Specified by:
addin interfaceCollection<Individual>- Specified by:
addin interfaceSet<Individual>
-
iterator
public Iterator<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
public void addListener(IndividualSetListener listener)
Adds a listener.- Parameters:
listener- the added listener- See Also:
removeListener(org.opt4j.core.IndividualSetListener)
-
removeListener
public void removeListener(IndividualSetListener listener)
Removes a listener.- Parameters:
listener- the removed listener- See Also:
addListener(org.opt4j.core.IndividualSetListener)
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<Individual>- Specified by:
clearin interfaceSet<Individual>
-
addAll
public boolean addAll(Collection<? extends Individual> c)
- Specified by:
addAllin interfaceCollection<Individual>- Specified by:
addAllin interfaceSet<Individual>
-
addAll
public boolean addAll(Individual... c)
Add allIndividuals.- Parameters:
c- the individuals to be added- Returns:
- true if at least one individual was added
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<Individual>- Specified by:
containsin interfaceSet<Individual>
-
containsAll
public boolean containsAll(Collection<?> c)
- 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
public boolean remove(Object o)
- Specified by:
removein interfaceCollection<Individual>- Specified by:
removein interfaceSet<Individual>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<Individual>- Specified by:
removeAllin interfaceSet<Individual>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<Individual>- Specified by:
retainAllin interfaceSet<Individual>
-
toArray
public Object[] 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>
-
-