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 Individual
s. It allows
to add and remove listeners, see IndividualSetListener
.- See Also:
-
optimizer.Archive
optimizer.Population
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Set<Individual>
protected final Set<IndividualSetListener>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(Individual individual) boolean
addAll
(Collection<? extends Individual> c) boolean
addAll
(Individual... c) Add allIndividual
s.void
addListener
(IndividualSetListener listener) Adds a listener.void
clear()
boolean
boolean
containsAll
(Collection<?> c) boolean
isEmpty()
iterator()
boolean
boolean
removeAll
(Collection<?> c) void
removeListener
(IndividualSetListener listener) Removes a listener.boolean
retainAll
(Collection<?> c) int
size()
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 Details
-
individuals
-
listeners
-
-
Constructor Details
-
IndividualSet
public IndividualSet()
-
-
Method Details
-
add
- Specified by:
add
in interfaceCollection<Individual>
- Specified by:
add
in interfaceSet<Individual>
-
iterator
- Specified by:
iterator
in interfaceCollection<Individual>
- Specified by:
iterator
in interfaceIterable<Individual>
- Specified by:
iterator
in interfaceSet<Individual>
-
size
public int size()- Specified by:
size
in interfaceCollection<Individual>
- Specified by:
size
in 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:
clear
in interfaceCollection<Individual>
- Specified by:
clear
in interfaceSet<Individual>
-
addAll
- Specified by:
addAll
in interfaceCollection<Individual>
- Specified by:
addAll
in interfaceSet<Individual>
-
addAll
Add allIndividual
s.- Parameters:
c
- the individuals to be added- Returns:
- true if at least one individual was added
-
contains
- Specified by:
contains
in interfaceCollection<Individual>
- Specified by:
contains
in interfaceSet<Individual>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<Individual>
- Specified by:
containsAll
in interfaceSet<Individual>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<Individual>
- Specified by:
isEmpty
in interfaceSet<Individual>
-
remove
- Specified by:
remove
in interfaceCollection<Individual>
- Specified by:
remove
in interfaceSet<Individual>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<Individual>
- Specified by:
removeAll
in interfaceSet<Individual>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<Individual>
- Specified by:
retainAll
in interfaceSet<Individual>
-
toArray
- Specified by:
toArray
in interfaceCollection<Individual>
- Specified by:
toArray
in interfaceSet<Individual>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArray
in interfaceCollection<Individual>
- Specified by:
toArray
in interfaceSet<Individual>
-