// are used in calculating the overall
// bidirectional metrics.
ogs.clearInstrumentation();
rgs.clearInstrumentation();
Node opNode = new Node(op.getInitialState());
Node rpNode = new Node(rp.getInitialState());
opFrontier.insert(opNode);
rpFrontier.insert(rpNode);
setQueueSize(opFrontier.size() + rpFrontier.size());
setNodesExpanded(ogs.getNodesExpanded() + rgs.getNodesExpanded());
while (!(opFrontier.isEmpty() && rpFrontier.isEmpty())) {
// Determine the nodes to work with and expand their fringes
// in preparation for testing whether or not the two
// searches meet or one or other is at the GOAL.
if (!opFrontier.isEmpty()) {
opNode = opFrontier.pop();
opFrontier.addAll(ogs.getResultingNodesToAddToFrontier(opNode,
op));
} else {
opNode = null;
}
if (!rpFrontier.isEmpty()) {
rpNode = rpFrontier.pop();
rpFrontier.addAll(rgs.getResultingNodesToAddToFrontier(rpNode,
rp));
} else {
rpNode = null;
}
setQueueSize(opFrontier.size() + rpFrontier.size());
setNodesExpanded(ogs.getNodesExpanded() + rgs.getNodesExpanded());
//
// First Check if either frontier contains the other's state
if (null != opNode && null != rpNode) {
Node popNode = null;
Node prpNode = null;
if (opFrontier.containsNodeBasedOn(rpNode.getState())) {
popNode = opFrontier.getNodeBasedOn(rpNode.getState());
prpNode = rpNode;
} else if (rpFrontier.containsNodeBasedOn(opNode.getState())) {
popNode = opNode;