Package org.moeaframework.parallel.util
Class ImmigrationQueue
java.lang.Object
org.moeaframework.parallel.util.ImmigrationQueue
A queue for tracking migrating solutions that is (1) thread-safe, and (2) automatically creates copies of the
solutions to avoid issues in shared-memory environments.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a copy of the solution to this immigration queue.voidaddAll(Collection<? extends Solution> solutions) Adds a copy of all solutions to this immigration queue.voidAdds a copy of all solutions to this immigration queue.booleanisEmpty()Returnstrueif this immigration queue is empty.pop()Removes and returns one solution from this immigration queue.popAll()Removes and returns all solutions currently in the immigration queue.intsize()Returns the number of solutions in the immigration queue
-
Constructor Details
-
ImmigrationQueue
public ImmigrationQueue()Creates a new, empty immigration queue.
-
-
Method Details
-
add
Adds a copy of the solution to this immigration queue.- Parameters:
solution- the solution to add
-
addAll
Adds a copy of all solutions to this immigration queue.- Parameters:
solutions- the solutions to add
-
addAll
Adds a copy of all solutions to this immigration queue.- Parameters:
solutions- the solutions to add
-
pop
Removes and returns one solution from this immigration queue.- Returns:
- the solution that was removed
-
popAll
Removes and returns all solutions currently in the immigration queue.- Returns:
- the solutions that were removed
-
size
public int size()Returns the number of solutions in the immigration queue- Returns:
- the number of solutions
-
isEmpty
public boolean isEmpty()Returnstrueif this immigration queue is empty.- Returns:
trueif empty;falseotherwise
-