/// <summary> /// Attaches the wagon from right. /// </summary> /// <param name="wagonId">The wagon identifier.</param> public void AttachWagonFromRight(int wagonId) { TrainNode tmp = new TrainNode(wagonId); if (Rightmost != null) { Rightmost.SetRightTrain(tmp); tmp.SetLeftTrain(Rightmost); Rightmost = tmp; } else { Leftmost = tmp; Rightmost = tmp; } }
public void AttachWagonFromRight(int wagonId) { var tmp = new TrainNode(wagonId); if (rightMost != null) { // Trains in composition rightMost.SetRightTrain(tmp); tmp.SetLeftTrain(rightMost); rightMost = tmp; } else { leftMost = tmp; rightMost = tmp; } }