New change request abstractions.

This commit is contained in:
Burak Kaan Köse
2024-11-26 20:03:10 +01:00
parent e81b7e2e61
commit a9fffd44d2
38 changed files with 769 additions and 1051 deletions

View File

@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
namespace Wino.Core.Extensions
{
@@ -19,40 +17,5 @@ namespace Wino.Core.Extensions
return nodes.Concat(descendants);
}
public static IEnumerable<IBatchChangeRequest> CreateBatch(this IEnumerable<IGrouping<MailSynchronizerOperation, IRequestBase>> items)
{
IBatchChangeRequest batch = null;
foreach (var group in items)
{
var key = group.Key;
}
yield return batch;
}
public static void AddSorted<T>(this List<T> @this, T item) where T : IComparable<T>
{
if (@this.Count == 0)
{
@this.Add(item);
return;
}
if (@this[@this.Count - 1].CompareTo(item) <= 0)
{
@this.Add(item);
return;
}
if (@this[0].CompareTo(item) >= 0)
{
@this.Insert(0, item);
return;
}
int index = @this.BinarySearch(item);
if (index < 0)
index = ~index;
@this.Insert(index, item);
}
}
}