private void FinishedReset(DijkstraNode current, DijkstraNode prev) { if (hitTarget(current)) { foreach (var tentative in _tentative) { tentative.Reset(); } _tentative.Clear(); if (_cont && _visualise && prev != null) { if (_text) { Say("A route to the target was found. The algorithm is finished"); } current.Reset(); } } else { if (_cont && _visualise && prev != null) { if (_text) { Say("There are no more nodes in the tentative list. The algorithm is finished"); } prev.Reset(); } } }
/// <summary> /// Visualise the process of choosing the next node. Will output text about what is going on if necessary. /// </summary> /// <param name="next">The next node to be current.</param> /// <param name="prev">The node that was previously current.</param> private void VisualiseChooseNext(DijkstraNode next, DijkstraNode prev) { if (_cont && !next.Equals(this)) { if (_cont && _text) { Say("8. There are nodes in the tentative list. Finding the node in tentative with the smallest cost"); Pause(); } Pause(3f); if (_cont && _text) { Say("9. new current = " + next.Name + " with cost " + next.GetDistanceFromRoot(ID)); Pause(); Say("10. Adding link between ct (" + prev.Name + ") and new current (" + next.Name + ") to the shortest path"); Pause(); } } prev.Reset(); IMLink confirmedLink = next.GetWIPRoute(ID); if (_cont && confirmedLink != null) { Pause(6f); confirmedLink.Colour = Color.Red; } if (_cont && _text) { Say((next.Equals(this) ? "2a" : "11a") + ". Adding " + (next.Equals(this) ? "root" : "new current") + " (" + next.Name + ") to Confirmed"); Pause(); Say((next.Equals(this) ? "2b" : "11b") + ". Setting current to " + (next.Equals(this) ? "root" : "new current") + " (" + next.Name + ")"); } next.Reset(); next.Selected = currentGlow; next.Colour = Color.White; if (_cont && _text && !next.Equals(this)) { Pause(); Say("11c. Going to step 4"); Pause(); } }
/// <summary> /// Visualise the process of choosing the next node. Will output text about what is going on if necessary. /// </summary> /// <param name="next">The next node to be current.</param> /// <param name="prev">The node that was previously current.</param> private void VisualiseChooseNext(DijkstraNode next, DijkstraNode prev) { if (_cont && !next.Equals(this)) { if (_cont && _text) { Say("8. There are nodes in the tentative list. Finding the node in tentative with the smallest cost"); Pause(); } Pause(3f); if (_cont && _text) { Say("9. new current = " + next.Name + " with cost " + next.GetDistanceFromRoot(ID)); Pause(); Say("10. Adding link between ct (" + prev.Name + ") and new current (" + next.Name + ") to the shortest path"); Pause(); } } prev.Reset(); IMLink confirmedLink = next.GetWIPRoute(ID); if (_cont && confirmedLink != null) { Pause(6f); confirmedLink.Colour = Color.Red; } if (_cont && _text) { Say((next.Equals(this) ? "2a" : "11a") + ". Adding " + (next.Equals(this) ? "root" : "new current") + " (" + next.Name + ") to Confirmed"); Pause(); Say((next.Equals(this) ? "2b" : "11b") + ". Setting current to " + (next.Equals(this) ? "root" : "new current") + " (" + next.Name + ")"); } next.Reset(); next.Selected = currentGlow; next.Colour = Color.White; if (_cont && _text && !next.Equals(this)) { Pause(); Say("11c. Going to step 4"); Pause(); } }
private void FinishedReset(DijkstraNode current, DijkstraNode prev) { if (hitTarget(current)) { foreach (var tentative in _tentative) tentative.Reset(); _tentative.Clear(); if (_cont && _visualise && prev != null) { if (_text) Say("A route to the target was found. The algorithm is finished"); current.Reset(); } } else { if (_cont && _visualise && prev != null) { if (_text) Say("There are no more nodes in the tentative list. The algorithm is finished"); prev.Reset(); } } }