public ListChangeEventArgs(ListChangeAction action) { this.NewStartingIndex = -1; this.OldStartingIndex = -1; (action == ListChangeAction.Reset).AssertTrue(); this.InitializeAdd(action, null, -1); }
public ListChangeEventArgs(ListChangeAction action) { this.NewStartingIndex = -1; this.OldStartingIndex = -1; (action == ListChangeAction.Reset).AssertTrue(); this.InitializeAdd(action, null, -1); }
public ListChangeEventArgs(ListChangeAction action, object newItem, object oldItem, int index) { this.NewStartingIndex = -1; this.OldStartingIndex = -1; (action == ListChangeAction.Replace).AssertTrue(); this.InitializeMoveOrReplace(action, new object[] { newItem }, new object[] { oldItem }, index, index); }
public ListChangeEventArgs(ListChangeAction action, IList changedItems, int index, int oldIndex) { this.NewStartingIndex = -1; this.OldStartingIndex = -1; (action == ListChangeAction.Move).AssertTrue(); (index >= 0).AssertTrue(); this.InitializeMoveOrReplace(action, changedItems, changedItems, index, oldIndex); }
public ListChangeEventArgs(ListChangeAction action, IList newItems, IList oldItems, int startingIndex) { this.NewStartingIndex = -1; this.OldStartingIndex = -1; (action == ListChangeAction.Replace).AssertTrue(); (newItems != null && oldItems != null).AssertTrue(); this.InitializeMoveOrReplace(action, newItems, oldItems, startingIndex, startingIndex); }
/// <summary> /// Applies the stack to the provided list /// </summary> /// <param name="list">The list to be modified</param> /// <param name="addUnique">True to use AddUnique, false to use Add</param> public void ApplyStackToList(IList <ElementType> list, bool addUnique = false) { ListChangeAction listAddAction = list.Add; if (addUnique) { listAddAction = (x) => list.AddUnique(x); } ApplyStack(listAddAction, (x) => list.Remove(x)); }
public ListChangeEventArgs(ListChangeAction action, object changedItem, int index, int oldIndex) { this.NewStartingIndex = -1; this.OldStartingIndex = -1; (action == ListChangeAction.Move).AssertTrue(); (index >= 0).AssertTrue(); var newItems = new object[] { changedItem }; this.InitializeMoveOrReplace(action, newItems, newItems, index, oldIndex); }
private void InitializeAddOrRemove(ListChangeAction action, IList changedItems, int startingIndex) { if (action == ListChangeAction.Add) { this.InitializeAdd(action, changedItems, startingIndex); } else if (action == ListChangeAction.Remove) { this.InitializeRemove(action, changedItems, startingIndex); } else { AssertionHelper.Fail(); } }
public ListChangeEventArgs(ListChangeAction action, object changedItem) { this.NewStartingIndex = -1; this.OldStartingIndex = -1; ((action == ListChangeAction.Add) || (action == ListChangeAction.Remove) || (action == ListChangeAction.Reset)).AssertTrue(); if (action == ListChangeAction.Reset) { changedItem.AssertNull(); this.InitializeAdd(action, null, -1); } else { this.InitializeAddOrRemove(action, new object[] { changedItem }, -1); } }
public ListChangeEventArgs(ListChangeAction action, object changedItem) { this.NewStartingIndex = -1; this.OldStartingIndex = -1; ((action == ListChangeAction.Add) || (action == ListChangeAction.Remove) || (action == ListChangeAction.Reset)).AssertTrue(); if (action == ListChangeAction.Reset) { changedItem.AssertNull(); this.InitializeAdd(action, null, -1); } else { this.InitializeAddOrRemove(action, new object[] { changedItem }, -1); } }
/// <summary> /// Applies the stack, being provided an Add Item action and /// a Remove Item action /// </summary> /// <param name="addCallback"></param> /// <param name="removeCallback"></param> public void ApplyStack(ListChangeAction addCallback, ListChangeAction removeCallback) { while (modificationsStack.Count > 0) { KeyValuePair <ElementType, ListModificationType> mod = modificationsStack.Pop(); switch (mod.Value) { case ListModificationType.ADD: addCallback(mod.Key); break; case ListModificationType.REMOVE: removeCallback(mod.Key); break; } } }
public ListChangeEventArgs(ListChangeAction action, IList changedItems, int startingIndex) { this.NewStartingIndex = -1; this.OldStartingIndex = -1; ((action == ListChangeAction.Add) || (action == ListChangeAction.Remove) || (action == ListChangeAction.Reset)).AssertTrue(); if (action == ListChangeAction.Reset) { changedItems.AssertNull(); (startingIndex == -1).AssertTrue(); this.InitializeAdd(action, null, -1); } else { changedItems.AssertNotNull(); (startingIndex != -1).AssertTrue(); this.InitializeAddOrRemove(action, changedItems, startingIndex); } }
public ListChangeEventArgs(ListChangeAction action, IList changedItems, int index, int oldIndex) { this.NewStartingIndex = -1; this.OldStartingIndex = -1; (action == ListChangeAction.Move).AssertTrue(); (index >= 0).AssertTrue(); this.InitializeMoveOrReplace(action, changedItems, changedItems, index, oldIndex); }
public ListChangeEventArgs(ListChangeAction action, IList newItems, IList oldItems) { this.NewStartingIndex = -1; this.OldStartingIndex = -1; (action == ListChangeAction.Replace).AssertTrue(); (newItems != null && oldItems != null).AssertTrue(); this.InitializeMoveOrReplace(action, newItems, oldItems, -1, -1); }
private void InitializeMoveOrReplace(ListChangeAction action, IList newItems, IList oldItems, int startingIndex, int oldStartingIndex) { this.InitializeAdd(action, newItems, startingIndex); this.InitializeRemove(action, oldItems, oldStartingIndex); }
private void InitializeRemove(ListChangeAction action, IList oldItems, int oldStartingIndex) { this.Action = action; this.OldItems = ArrayList.ReadOnly(oldItems ?? new ArrayList()); this.OldStartingIndex = oldStartingIndex; }
private void InitializeAdd(ListChangeAction action, IList newItems, int newStartingIndex) { this.Action = action; this.NewItems = ArrayList.ReadOnly(newItems ?? new ArrayList()); this.NewStartingIndex = newStartingIndex; }
private void InitializeAdd(ListChangeAction action, IList newItems, int newStartingIndex) { this.Action = action; this.NewItems = ArrayList.ReadOnly(newItems ?? new ArrayList()); this.NewStartingIndex = newStartingIndex; }
private void InitializeRemove(ListChangeAction action, IList oldItems, int oldStartingIndex) { this.Action = action; this.OldItems = ArrayList.ReadOnly(oldItems ?? new ArrayList()); this.OldStartingIndex = oldStartingIndex; }
private void InitializeMoveOrReplace(ListChangeAction action, IList newItems, IList oldItems, int startingIndex, int oldStartingIndex) { this.InitializeAdd(action, newItems, startingIndex); this.InitializeRemove(action, oldItems, oldStartingIndex); }
private void InitializeAddOrRemove(ListChangeAction action, IList changedItems, int startingIndex) { if (action == ListChangeAction.Add) { this.InitializeAdd(action, changedItems, startingIndex); } else if (action == ListChangeAction.Remove) { this.InitializeRemove(action, changedItems, startingIndex); } else { AssertionHelper.Fail(); } }
public ListChangeEventArgs(ListChangeAction action, object newItem, object oldItem, int index) { this.NewStartingIndex = -1; this.OldStartingIndex = -1; (action == ListChangeAction.Replace).AssertTrue(); this.InitializeMoveOrReplace(action, new object[] { newItem }, new object[] { oldItem }, index, index); }
public ListChangeEventArgs(ListChangeAction action, object changedItem, int index, int oldIndex) { this.NewStartingIndex = -1; this.OldStartingIndex = -1; (action == ListChangeAction.Move).AssertTrue(); (index >= 0).AssertTrue(); var newItems = new object[] { changedItem }; this.InitializeMoveOrReplace(action, newItems, newItems, index, oldIndex); }
public ListChangeEventArgs(ListChangeAction action, IList changedItems, int startingIndex) { this.NewStartingIndex = -1; this.OldStartingIndex = -1; ((action == ListChangeAction.Add) || (action == ListChangeAction.Remove) || (action == ListChangeAction.Reset)).AssertTrue(); if (action == ListChangeAction.Reset) { changedItems.AssertNull(); (startingIndex == -1).AssertTrue(); this.InitializeAdd(action, null, -1); } else { changedItems.AssertNotNull(); (startingIndex != -1).AssertTrue(); this.InitializeAddOrRemove(action, changedItems, startingIndex); } }