Package search
Interface FrontierStructure<Node>
- Type Parameters:
Node
- The type of tree nodes stored in the frontier.
- All Known Subinterfaces:
FrontierCheckingStructure<Node>
- All Known Implementing Classes:
Frontiers.DebuggablePriorityQueue
,Frontiers.DebuggingFrontier
,Frontiers.PriorityQueue
,Frontiers.Queue
,Frontiers.StateKeyedPriorityQueue
public interface FrontierStructure<Node>
Methods required of a representation of a search tree frontier.
The
Frontiers
class contains some standard implementations
and utilities of this interface.- See Also:
GraphSearcher.search(State)
,Frontiers
-
Method Summary
Modifier and Type Method Description void
add(Node n)
Adds a (usually newly-generated) tree node to the frontier.int
countOpen()
Returns the number of open nodes sitting unexpanded in the frontier.default void
debugDisplayFrontier()
Print debugging information about the frontier.boolean
isEmpty()
Checks whether any tree nodes remain in the frontierNode
pop()
Removes one tree node from the frontier, and returns it.
-
Method Details
-
add
Adds a (usually newly-generated) tree node to the frontier.- Parameters:
n
- The new node
-
isEmpty
boolean isEmpty()Checks whether any tree nodes remain in the frontier- Returns:
- false when the frontier is empty, which generally indicates that the search has failed.
-
pop
Node pop()Removes one tree node from the frontier, and returns it.- Returns:
- The dequeued tree node
- Throws:
IllegalStateException
- when this method is called but the frontier is empty; the exception may contain a cause if the exception was generated by some other data structure.
-
countOpen
int countOpen()Returns the number of open nodes sitting unexpanded in the frontier.- Returns:
- The number of open nodes
-
debugDisplayFrontier
default void debugDisplayFrontier()Print debugging information about the frontier. By default, does nothing.
-