Package search
Class Frontiers.Queue<Node>
java.lang.Object
search.Frontiers.Queue<Node>
- All Implemented Interfaces:
FrontierCheckingStructure<Node>,FrontierStructure<Node>
- Enclosing class:
- Frontiers
public static class Frontiers.Queue<Node> extends Object implements FrontierCheckingStructure<Node>
A queue as a priority queue, for e.g. BFS.
-
Constructor Summary
Constructors Constructor Description Queue() -
Method Summary
Modifier and Type Method Description voidadd(Node n)Adds a (usually newly-generated) tree node to the frontier.booleancontains(Node n)intcountOpen()Returns the number of open nodes sitting unexpanded in the frontier.booleanisEmpty()Checks whether any tree nodes remain in the frontierNodepop()Removes one tree node from the frontier, and returns it.
-
Constructor Details
-
Queue
public Queue()
-
-
Method Details
-
add
Description copied from interface:FrontierStructureAdds a (usually newly-generated) tree node to the frontier.- Specified by:
addin interfaceFrontierStructure<Node>- Parameters:
n- The new node
-
isEmpty
public boolean isEmpty()Description copied from interface:FrontierStructureChecks whether any tree nodes remain in the frontier- Specified by:
isEmptyin interfaceFrontierStructure<Node>- Returns:
- false when the frontier is empty, which generally indicates that the search has failed.
-
pop
Description copied from interface:FrontierStructureRemoves one tree node from the frontier, and returns it.- Specified by:
popin interfaceFrontierStructure<Node>- Returns:
- The dequeued tree node
-
countOpen
public int countOpen()Description copied from interface:FrontierStructureReturns the number of open nodes sitting unexpanded in the frontier.- Specified by:
countOpenin interfaceFrontierStructure<Node>- Returns:
- The number of open nodes
-
contains
- Specified by:
containsin interfaceFrontierCheckingStructure<Node>
-