Ticket #2106: stablesort.patch
File stablesort.patch, 1.9 KB (added by abeham, 11 years ago) |
---|
-
HeuristicLab.Collections/3.3/HeuristicLab.Collections-3.3.csproj
112 112 <Reference Include="System.Xml" /> 113 113 </ItemGroup> 114 114 <ItemGroup> 115 <Compile Include="TempComparer.cs" /> 115 116 <None Include="Plugin.cs.frame" /> 116 117 <Compile Include="BidirectionalDictionary.cs" /> 117 118 <Compile Include="BidirectionalLookup.cs" /> -
HeuristicLab.Collections/3.3/ObservableList.cs
327 327 public void Sort(Comparison<T> comparison) { 328 328 if (list.Count > 1) { 329 329 IndexedItem<T>[] oldItems = GetIndexedItems(); 330 list.Sort(comparison); 330 list = list.OrderBy(x => x, new TempComparer<T>(comparison)).ToList(); 331 //list.Sort(comparison); 331 332 OnItemsMoved(GetIndexedItems(), oldItems); 332 333 OnPropertyChanged("Item[]"); 333 334 } -
HeuristicLab.Collections/3.3/TempComparer.cs
1 using System; 2 using System.Collections.Generic; 3 4 namespace HeuristicLab.Collections { 5 public class TempComparer<T> : IComparer<T> { 6 public TempComparer(Comparison<T> comparison) { 7 this.Comparison = comparison; 8 } 9 public int Compare(T x, T y) { 10 return Comparison.Invoke(x, y); 11 } 12 13 public Comparison<T> Comparison { get; set; } 14 } 15 }