/// <summary> /// This funciton is deprecated. Return -1 /// </summary> /// <param name="value"></param> /// <param name="comparer"></param> /// <returns></returns> public override int BinarySearch(object value, System.Collections.IComparer comparer) { #if DEBUG #endif return((int)-1); }
public override int CompareTo(object other, System.Collections.IComparer comparer) { if (other == null) { return(0); } if (other is Cons <T> ) { var cons = (Cons <T>)other; int headComparisonResult = comparer.Compare(this.head, cons.head); if (headComparisonResult != 0) { return(headComparisonResult); } else { return(this.tail.CompareTo(cons.tail, comparer)); } } if (other is Nil <T> ) { return(1); } else { return(0); } }
/// <summary> /// Sorts an IList collections /// </summary> /// <param name="list">The System.Collections.IList instance that will be sorted</param> /// <param name="Comparator">The Comparator criteria, null to use natural comparator.</param> public static void Sort(System.Collections.IList list, System.Collections.IComparer Comparator) { if (((System.Collections.ArrayList)list).IsReadOnly) { throw new System.NotSupportedException(); } if ((Comparator == null) || (Comparator is System.Collections.Comparer)) { try { ((System.Collections.ArrayList)list).Sort(); } catch (System.InvalidOperationException e) { throw new System.InvalidCastException(e.Message); } } else { try { ((System.Collections.ArrayList)list).Sort(Comparator); } catch (System.InvalidOperationException e) { throw new System.InvalidCastException(e.Message); } } }
public override void Sort(System.Collections.IComparer comparer) { if (dataSource == null) // if no datasource is set, then bind to the grid itself dataSource = new DataSourceManager(this, null); dataSource.Sort(comparer); FillGrid(groupTemplate); }
public override void Sort(System.Collections.IComparer comparer) { base.Sort(comparer); if (dataSource == null) { dataSource = new DataSourceManager(this, null); } dataSource.Sort(comparer); FillGrid(groupTemplate); }
public static bool ArrayContains(Array array, object value, System.Collections.IComparer comparer) { foreach (object item in array) { if (comparer.Compare(item, value) == 0) { return(true); } } return(false); }
public void Sort(System.Collections.IComparer comparer) { try { Rows.Sort(new DataSourceRowComparer(comparer)); } catch (Exception Ex) { // throw; } }
public bool Equals(object other, System.Collections.IComparer comparer) { if (comparer.Compare(other, this) == 0) { return(true); } else { return(false); } }
public void Sort(String comparerName) { Type type = GetType().GetNestedType(comparerName); if (type == null) { throw new System.ArgumentException(String.Format("Comparer {0} not found in class {1}.", comparerName, GetType().Name)); } System.Collections.IComparer comparer = Activator.CreateInstance(type) as System.Collections.IComparer; if (comparer == null) { throw new System.ArgumentException("compareName must be the name of class that implements IComparer."); } this.InnerList.Sort(comparer); }
public override int CompareTo(object other, System.Collections.IComparer comparer) { if (other == null) { return(0); } if (other is Some <T> ) { var some = (Some <T>)other; return(comparer.Compare(this.value, some.value)); } else if (other is None <T> ) { return(1); } else { return(0); } }
public override int CompareTo(object other, System.Collections.IComparer comparer) { if (other == null) { return(0); } if (other is Some <T> ) { return(-1); } else if (other is None <T> ) { var none = (None <T>)other; return(comparer.Compare(this.GetType().DeclaringType, none.GetType().DeclaringType)); } else { return(comparer.Compare(this, other)); } }
public void Sort(System.Collections.IComparer comparer) { this.InnerList.Sort(comparer); }
public void Sort(System.Collections.IComparer cmp) { list.Sort(cmp); }
public SdodWrapper(File.IFile file, System.Collections.IComparer comparer, string name, bool isDataInKeySegment) { RealDictionary = new SortedDictionaryOnDisk(file, comparer, name, isDataInKeySegment); }
public RecordComparer(System.Collections.IComparer comparer) { _comparer = comparer; }
public void Sort(System.Collections.IComparer comparer) { Rows.Sort(new DataSourceRowComparer(comparer)); }
public RecordComparer(System.Collections.IComparer comparer) { _comparer = comparer; }
int System.Collections.IStructuralComparable.CompareTo(object other, System.Collections.IComparer comparer) { return(this.CompareTo(other, comparer)); }
public abstract int CompareTo(object other, System.Collections.IComparer comparer);
public void RangeConstructorComparerThrowExceptionIfFromIsLessThanTo(object testObj, object from, object to, System.Collections.IComparer comparer) { RangeConstraint test = new RangeConstraint(from, to); test.Using(comparer); test.ApplyTo(testObj); }
/// <summary> /// Obtain the minimum element of the given collection with the specified comparator. /// </summary> /// <param name="Collection">Collection from which the minimum value will be obtained.</param> /// <param name="Comparator">The comparator with which to determine the minimum element.</param> /// <returns></returns> public static System.Object Min(System.Collections.ICollection Collection, System.Collections.IComparer Comparator) { System.Collections.ArrayList tempArrayList; if (((System.Collections.ArrayList)Collection).IsReadOnly) { throw new System.NotSupportedException(); } if ((Comparator == null) || (Comparator is System.Collections.Comparer)) { try { tempArrayList = new System.Collections.ArrayList(Collection); tempArrayList.Sort(); } catch (System.InvalidOperationException e) { throw new System.InvalidCastException(e.Message); } return((System.Object)tempArrayList[0]); } else { try { tempArrayList = new System.Collections.ArrayList(Collection); tempArrayList.Sort(Comparator); } catch (System.InvalidOperationException e) { throw new System.InvalidCastException(e.Message); } return((System.Object)tempArrayList[0]); } }