copy method

  1. @override
GraphState copy()
override

Implementation

@override
GraphState copy() {
  GraphDijkstraState newState = GraphDijkstraState(
    startId: startId,
    targetId: targetId,
    status: status,
    parents: HashMap.from(parents),
    edges: HashMap.from(edges),
    coords: HashMap.from(coords),
    nodes: HashMap.from(nodes),
    open: PriorityQueue((a, b) => gCost[a]!.compareTo(gCost[b]!)),
    gCost: HashMap.from(gCost),
  );

  newState.open = PriorityQueue<int>(
      (a, b) => newState.gCost[a]!.compareTo(newState.gCost[b]!));
  newState.open.addAll(open.toList());

  return newState;
}