copy method

  1. @override
GraphState copy()
override

Implementation

@override
GraphState copy() {
  GraphAstarState newState = GraphAstarState(
    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) => fCost[a]!.compareTo(fCost[b]!)),
    gCost: HashMap.from(gCost),
    fCost: HashMap.from(fCost),
  );

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

  return newState;
}