Interface ExpandCollection<N>
- Type Parameters:
N
-
- All Known Implementing Classes:
BreadthFirstExpandCollection
,DepthFirstExpandCollection
public interface ExpandCollection<N>
- Author:
- bfvdonge
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(Collection<? extends N> newElements) Adds the given elements to the collection.boolean
isEmpty()
Checks whether or not the collection retained by this ExpandCollection is empty.pop()
Gets and removes the first element to be expanded by the node expander.
-
Method Details
-
pop
N pop()Gets and removes the first element to be expanded by the node expander. Implementing classes may assume that isEmpty() returns false before any call to pop, i.e. the first line of the implementation can be:assert (!isEmpty())
- Returns:
- the first element to be investigated by the searcher.
-
add
Adds the given elements to the collection. Note that implementing classes may safely assume that the calling thread owns the monitor, i.e. there is no need to synchronize on the collection retained by this expandcollection and removals are allowed. Furthermore, the implementing class may decide not to include any of the given newElements if it decides that they are not to be investigated further.- Parameters:
newElements
- the nodes to expand further
-
isEmpty
boolean isEmpty()Checks whether or not the collection retained by this ExpandCollection is empty. If this method returns false, a call to pop() can be made.- Returns:
-