Class ImmigrationQueue

java.lang.Object
org.moeaframework.parallel.util.ImmigrationQueue

public class ImmigrationQueue extends Object
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
    Constructor
    Description
    Creates a new, empty immigration queue.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(Solution solution)
    Adds a copy of the solution to this immigration queue.
    void
    addAll(Collection<? extends Solution> solutions)
    Adds a copy of all solutions to this immigration queue.
    void
    addAll(Solution[] solutions)
    Adds a copy of all solutions to this immigration queue.
    boolean
    Returns true if this immigration queue is empty.
    pop()
    Removes and returns one solution from this immigration queue.
    Removes and returns all solutions currently in the immigration queue.
    int
    Returns the number of solutions in the immigration queue

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ImmigrationQueue

      public ImmigrationQueue()
      Creates a new, empty immigration queue.
  • Method Details

    • add

      public void add(Solution solution)
      Adds a copy of the solution to this immigration queue.
      Parameters:
      solution - the solution to add
    • addAll

      public void addAll(Solution[] solutions)
      Adds a copy of all solutions to this immigration queue.
      Parameters:
      solutions - the solutions to add
    • addAll

      public void addAll(Collection<? extends Solution> solutions)
      Adds a copy of all solutions to this immigration queue.
      Parameters:
      solutions - the solutions to add
    • pop

      public Solution pop()
      Removes and returns one solution from this immigration queue.
      Returns:
      the solution that was removed
    • popAll

      public List<Solution> 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()
      Returns true if this immigration queue is empty.
      Returns:
      true if empty; false otherwise