public OnRemovalFromSolver ( Solver oldSolver ) : void | ||
oldSolver | Solver | Solver from which the updateable was removed. |
return | void |
///<summary> /// Removes a solver updateable from the solver. ///</summary> ///<param name="item">Updateable to remove.</param> ///<exception cref="ArgumentException">Thrown when the item does not belong to the solver.</exception> public void Remove(SolverUpdateable item) { if (item.Solver == this) { item.Solver = null; solverUpdateables.Count--; if (item.solverIndex < solverUpdateables.Count) { //The solver updateable isn't the last element, so put the last element in its place. solverUpdateables.Elements[item.solverIndex] = solverUpdateables.Elements[solverUpdateables.Count]; //Update the replacement's solver index to its new location. solverUpdateables.Elements[item.solverIndex].solverIndex = item.solverIndex; } solverUpdateables.Elements[solverUpdateables.Count] = null; DeactivationManager.Remove(item.simulationIslandConnection); item.OnRemovalFromSolver(this); } else { throw new ArgumentException("Solver updateable doesn't belong to this solver; it can't be removed.", "item"); } }
///<summary> /// Removes a solver updateable from the solver. ///</summary> ///<param name="item">Updateable to remove.</param> ///<exception cref="ArgumentException">Thrown when the item does not belong to the solver.</exception> public void Remove(SolverUpdateable item) { if (item.Solver == this) { item.Solver = null; solverUpdateables.Count--; if (item.solverIndex < solverUpdateables.Count) { //The solver updateable isn't the last element, so put the last element in its place. solverUpdateables.Elements[item.solverIndex] = solverUpdateables.Elements[solverUpdateables.Count]; //Update the replacement's solver index to its new location. solverUpdateables.Elements[item.solverIndex].solverIndex = item.solverIndex; } solverUpdateables.Elements[solverUpdateables.Count] = null; DeactivationManager.Remove(item.simulationIslandConnection); item.OnRemovalFromSolver(this); } else throw new ArgumentException("Solver updateable doesn't belong to this solver; it can't be removed.", "item"); }