@Override protected void addToFrontier(Node node){
  if (!explored.contains(node.getState())) {
    Node frontierNode=frontierNodeLookup.get(node.getState());
    if (frontierNode == null) {
      frontier.add(node);
      frontierNodeLookup.put(node.getState(),node);
      updateMetrics(frontier.size());
    }
 else     if (nodeComparator != null && nodeComparator.compare(node,frontierNode) < 0) {
      if (frontier.remove(frontierNode))       frontierNodeLookup.remove(frontierNode.getState());
      frontier.add(node);
      frontierNodeLookup.put(node.getState(),node);
    }
  }
}

@ Override protected void addToFrontier ( Node node ) { if ( ! explored . contains ( node . getState ( ) ) ) { Node frontierNode = frontierNodeLookup . get ( node . getState ( ) ) ; if ( frontierNode == null ) { frontier . add ( node ) ; frontierNodeLookup . put ( node . getState ( ) , node ) ; updateMetrics ( frontier . size ( ) ) ; } else if ( nodeComparator != null && nodeComparator . compare ( node , frontierNode ) < 0 ) { if ( frontier . remove ( frontierNode ) ) frontierNodeLookup . remove ( frontierNode . getState ( ) ) ; frontier . add ( node ) ; frontierNodeLookup . put ( node . getState ( ) , node ) ; } } }
inserts the node into the frontier if the node ' s state is not yet explored and not present in the frontier . if a second node for the same state is already part of the frontier , it is checked , which node is better ( with respect to priority ) . depending of the result , the existing node is replaced or the new node is dropped .
