nl.liacs.subdisc
Class CandidateQueue

java.lang.Object
  extended by nl.liacs.subdisc.CandidateQueue

public class CandidateQueue
extends java.lang.Object

A CandidateQueue holds a collection of Candidates for future processing. These are ordered as dictated by Candidate's compareTo(Candidate) method. This class is thread save.

See Also:
Candidate

Constructor Summary
CandidateQueue(SearchParameters theSearchParameters, Candidate theRootCandidate)
           
 
Method Summary
 boolean add(Candidate theCandidate)
          Adds a Candidate to this CandidateQueue.
 int currentLevelQueueSize()
          Returns the number of Candidates in the current queue level of this CandidateQueue.
 Candidate removeFirst()
          Retrieves first Candidate from this CandidateQueue, and moves to next level if required.
 int size()
          Returns the total number of Candidates in this CandidateQueue.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CandidateQueue

public CandidateQueue(SearchParameters theSearchParameters,
                      Candidate theRootCandidate)
Method Detail

add

public boolean add(Candidate theCandidate)
Adds a Candidate to this CandidateQueue. The add() and removeFirst() methods are thread save.

Parameters:
theCandidate - the Candidate to add.
Returns:
true if Candidate is added, false otherwise.
See Also:
removeFirst(), Candidate

removeFirst

public Candidate removeFirst()
Retrieves first Candidate from this CandidateQueue, and moves to next level if required. The add() and removeFirst() methods are thread save.

Returns:
the Candidate at the head of this CandidateQueue.
See Also:
add(Candidate), Candidate

size

public int size()
Returns the total number of Candidates in this CandidateQueue. Thread save with respect to add() and removeFirst().

Returns:
the size of the current queue level.
See Also:
add(Candidate), removeFirst(), Candidate

currentLevelQueueSize

public int currentLevelQueueSize()
Returns the number of Candidates in the current queue level of this CandidateQueue. Thread save with respect to add() and removeFirst().

Returns:
the size of the current queue level.
See Also:
add(Candidate), removeFirst(), Candidate