private void DifferenceScan(ListFast <T> listFastReference, out ListFast <T> listFastBaseDifference, out ListFast <T> listFastReferenceDifference) { listFastBaseDifference = new ListFast <T>() { Unique = true }; listFastReferenceDifference = new ListFast <T>() { Unique = true }; int count = this.Count; //Base to Reference for (int i = 0; i < count; i++) { T value = this._items[i]; if (!listFastReference.Contains(value)) { listFastBaseDifference.Add(value); } } //Reference to Base count = listFastReference.Count; for (int i = 0; i < count; i++) { T value = listFastReference._items[i]; if (!listFastReferenceDifference.Contains(value)) { listFastReferenceDifference.Add(value); } } }
public ListFast(ListFast <T> list) { this.MinSizeSearchSeek = list.MinSizeSearchSeek; this.MinSizeSearchStartSeek = list.MinSizeSearchStartSeek; this.StepSizeSearchStartSeek = list.StepSizeSearchStartSeek; this.IsAddSorted = list.IsAddSorted; this.Unique = list.Unique; this._items.AddRange(list._items); }
public bool Difference(ListFast <T> listFastReference, out ListFast <T> listFastBaseDifference, out ListFast <T> listFastReferenceDifference) { //Seek //if ((this._isSorted) && (listFastReference._isSorted)) // this.DifferenceSeek(listFastReference, out listFastBaseDifference, out listFastReferenceDifference); //else //Scan this.DifferenceScan(listFastReference, out listFastBaseDifference, out listFastReferenceDifference); return((listFastBaseDifference.Count > 0) || (listFastReferenceDifference.Count > 0)); }
public void Replace(ListFast <T> listFast) { this._items = listFast._items; if ((this._isSorted) && (!listFast._isSorted)) { this._isSorted = false; } this.EnsureSort(); }
private bool IsEqualScan(ListFast <T> list) { for (int i = 0; i < this.Count; i++) { if (!list.Contains(this[i])) { return(false); } } return(true); }
private bool IsEqualSeek(ListFast <T> list) { for (int i = 0; i < this.Count; i++) { if (Compare(this[i], list[i]) != 0) { return(false); } } return(true); }
public ListFast <int> Intersection(ListFast <int> list1, ListFast <int> list2) { ListFast <int> list = new ListFast <int>(); for (int i = list1.Count; i >= 0; i--) { int value = list1[i]; if (list2.Contains(value)) { list.Add(value); } } return(list); }
public bool IsEqual(ListFast <T> list) { if (this.Count != list.Count) { return(false); } //Seek if ((this._isSorted) && (list._isSorted)) { return(IsEqualSeek(list)); } //Scan return(IsEqualScan(list)); }
private void DifferenceSeek(ListFast <T> listReference, out ListFast <T> listFastBaseDifference, out ListFast <T> listFastReferenceDifference) { //TODO: Work over here listFastBaseDifference = new ListFast <T>() { Unique = true }; listFastReferenceDifference = new ListFast <T>() { Unique = true }; if (this.Count < listReference.Count) { int count = this.Count; for (int i = 0; i < count; i++) { } } else { } }