/// <summary> /// Changes the source of the edge from the old source to the given new source, /// and changes the target node of the edge from the old target to the given new target. /// </summary> /// <param name="edge">The edge to redirect.</param> /// <param name="newSource">The new source node of the edge.</param> /// <param name="newTarget">The new target node of the edge.</param> /// <param name="oldSourceName">The name of the old source node (used for debug display of the new edge).</param> /// <param name="oldTargetName">The name of the old target node (used for debug display of the new edge).</param> public void RedirectSourceAndTarget(LGSPEdge edge, LGSPNode newSource, LGSPNode newTarget, string oldSourceName, string oldTargetName) { RedirectingEdge(edge); RemovingEdge(edge); edge.lgspSource.RemoveOutgoing(edge); newSource.AddOutgoing(edge); edge.lgspSource = newSource; edge.lgspTarget.RemoveIncoming(edge); newTarget.AddIncoming(edge); edge.lgspTarget = newTarget; nameOfSingleElementAdded[0] = "redirected from " + oldSourceName + " --> " + oldTargetName; SettingAddedEdgeNames(nameOfSingleElementAdded); EdgeAdded(edge); ++changesCounter; }
/// <summary> /// Changes the source node of the edge from the old source to the given new source. /// </summary> /// <param name="edge">The edge to redirect.</param> /// <param name="newSource">The new source node of the edge.</param> /// <param name="oldSourceName">The name of the old source node (used for debug display of the new edge).</param> public void RedirectSource(LGSPEdge edge, LGSPNode newSource, string oldSourceName) { RedirectingEdge(edge); RemovingEdge(edge); edge.lgspSource.RemoveOutgoing(edge); newSource.AddOutgoing(edge); edge.lgspSource = newSource; nameOfSingleElementAdded[0] = "redirected from " + oldSourceName + " --> ."; SettingAddedEdgeNames(nameOfSingleElementAdded); EdgeAdded(edge); ++changesCounter; }