/// <summary> /// Returns a portion of the list whose elements are greater that the lowerLimit parameter less than the upperLimit parameter. /// </summary> /// <param name="lowerLimit">The start element of the portion to extract.</param> /// <param name="upperLimit">The end element of the portion to extract.</param> /// <returns>The portion of the collection.</returns> public SortedSetSupport SubSet(System.Object lowerLimit, System.Object upperLimit) { SortedSetSupport newList = new TreeSetSupport(); int i = 0; while (this.comparator.Compare(this[i], lowerLimit) < 0) i++; for (; i < this.Count; i++) { if (this.comparator.Compare(this[i], upperLimit) >= 0) break; newList.Add(this[i]); } return newList; }
/// <summary> /// Returns a portion of the list whose elements are greater than the limit object parameter. /// </summary> /// <param name="limit">The start element of the portion to extract.</param> /// <returns>The portion of the collection whose elements are greater than the limit object parameter.</returns> public SortedSetSupport TailSet(System.Object limit) { SortedSetSupport newList = new TreeSetSupport(); int i = 0; while (this.comparator.Compare(this[i], limit) < 0) i++; for (; i < this.Count; i++) newList.Add(this[i]); return newList; }
/// <summary> /// Returns a portion of the list whose elements are less than the limit object parameter. /// </summary> /// <param name="limit">The end element of the portion to extract.</param> /// <returns>The portion of the collection whose elements are less than the limit object parameter.</returns> public SortedSetSupport HeadSet(System.Object limit) { SortedSetSupport newList = new TreeSetSupport(); for (int i = 0; i < this.Count; i++) { if (this.comparator.Compare(this[i], limit) >= 0) break; newList.Add(this[i]); } return newList; }