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>
TheIndividualSet
is aSet
ofIndividual
s. 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>
individuals
protected Set<IndividualSetListener>
listeners
-
Constructor Summary
Constructors Constructor Description IndividualSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
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
contains(Object o)
boolean
containsAll(Collection<?> c)
boolean
isEmpty()
Iterator<Individual>
iterator()
boolean
remove(Object o)
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 Detail
-
individuals
protected final Set<Individual> individuals
-
listeners
protected final Set<IndividualSetListener> listeners
-
-
Method Detail
-
add
public boolean add(Individual individual)
- Specified by:
add
in interfaceCollection<Individual>
- Specified by:
add
in interfaceSet<Individual>
-
iterator
public Iterator<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
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:
clear
in interfaceCollection<Individual>
- Specified by:
clear
in interfaceSet<Individual>
-
addAll
public boolean addAll(Collection<? extends Individual> c)
- Specified by:
addAll
in interfaceCollection<Individual>
- Specified by:
addAll
in interfaceSet<Individual>
-
addAll
public boolean addAll(Individual... c)
Add allIndividual
s.- Parameters:
c
- the individuals to be added- Returns:
- true if at least one individual was added
-
contains
public boolean contains(Object o)
- Specified by:
contains
in interfaceCollection<Individual>
- Specified by:
contains
in interfaceSet<Individual>
-
containsAll
public boolean containsAll(Collection<?> c)
- 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
public boolean remove(Object o)
- Specified by:
remove
in interfaceCollection<Individual>
- Specified by:
remove
in interfaceSet<Individual>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<Individual>
- Specified by:
removeAll
in interfaceSet<Individual>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<Individual>
- Specified by:
retainAll
in interfaceSet<Individual>
-
toArray
public Object[] 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>
-
-