public override void Deserialize(IntermediateFormatReader reader) { reader.RegisterDeclaration(m_declaration); IScalabilityCache scalabilityCache = reader.PersistenceHelper as IScalabilityCache; while (reader.NextMember()) { switch (reader.CurrentMember.MemberName) { case MemberName.ExpressionType: m_expressionType = (Microsoft.ReportingServices.ReportProcessing.DataAggregate.DataTypeCode)reader.ReadEnum(); break; case MemberName.CurrentMin: m_currentMin = reader.ReadVariant(); break; case MemberName.Comparer: { int id = reader.ReadInt32(); m_comparer = (Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ProcessingComparer)scalabilityCache.FetchStaticReference(id); break; } default: Global.Tracer.Assert(condition: false); break; } } }
public static void BubbleDown <T>(this T[] source, int length, int index, IDataComparer <T> comparer) { int curIdx = index; while (curIdx < length) { int leftIndex = LeftIndex(curIdx); if (leftIndex >= length) { return; } int rightIndex = RightIndex(curIdx); int maxChildIdx = leftIndex; if (rightIndex < length && comparer.Compare(source[rightIndex], source[leftIndex]).IsFirstMore) { maxChildIdx = rightIndex; } if (comparer.Compare(source[maxChildIdx], source[curIdx]).IsFirstMore) { source.Swap(curIdx, maxChildIdx); curIdx = maxChildIdx; continue; } return; } }
public TeamRepository( IDbConnection connection, IDataComparer dataComparer, ITeamSqlGenerator sqlGenerator) : base( connection, dataComparer, sqlGenerator) => (_connection, _sqlGenerator) = (connection, sqlGenerator);
public ProjectRepository( IDbConnection connection, IDataComparer dataComparer, IProjectSqlGenerator sqlGenerator) : base( connection, dataComparer, sqlGenerator) => (_connection, _sqlGenerator) = (connection, sqlGenerator);
public DeliverableTypeRepository( IDbConnection connection, IDataComparer datacomparer, ISqlGenerator sqlGeneratorBase) : base( connection, datacomparer, sqlGeneratorBase) { }
public JurisdictionRepository( IDbConnection connection, IDataComparer datacomparer, ISqlGenerator sqlGeneratorBase) : base( connection, datacomparer, sqlGeneratorBase) { }
public QuarterDueDateRepository( IDbConnection connection, IDataComparer datacomparer, ISqlGenerator sqlGeneratorBase) : base( connection, datacomparer, sqlGeneratorBase) { }
public TaxPayerTypeRepository( IDbConnection connection, IDataComparer datacomparer, ISqlGenerator sqlGeneratorBase) : base( connection, datacomparer, sqlGeneratorBase) { }
public Repository( IDbConnection connection, IDataComparer datacomparer, ISqlGenerator sqlGeneratorBase) { Current = new List <CleanEntity <TEntity> >(); ActionCreated = delegate { }; _connection = connection; _dataComparer = datacomparer; _sqlGeneratorBase = sqlGeneratorBase; }
public FormRepository( IDbConnection connection, IDataComparer datacomparer, IFormSqlGenerator sqlGeneratorBase) : base( connection, datacomparer, sqlGeneratorBase) { _sqlGenerator = sqlGeneratorBase; _connection = connection; _dataComparer = datacomparer; }
public static T[] ApplyInsertionSort <T>(this T[] source, IDataComparer <T> comparer) { for (int idx = 1; idx < source.Length; idx++) { T currentItem = source[idx]; int prev = idx - 1; while (prev >= 0 && comparer.Compare(source[prev], currentItem).IsFirstMore) { source[prev + 1] = source[prev]; prev--; } source[prev + 1] = currentItem; } return(source); }
public static T[] ApplySelectionSort <T>(this T[] source, IDataComparer <T> comparer) { for (int swapIdx = 0; swapIdx < source.Length - 1; swapIdx++) { int minIdx = swapIdx; for (int idx = swapIdx + 1; idx < source.Length; idx++) { var item1 = source[minIdx]; var item2 = source[idx]; if (comparer.Compare(item1, item2).IsFirstMore) { minIdx = idx; } } source.Swap(swapIdx, minIdx); } return(source); }
public UnitOfWork( IDbConnection connection, ITeamRepository teams, IProjectRepository projects, IDueDateRepository duedates, ITaxPayerTypeRepository taxPayerTypes, IDeliverableTypeRepository deliverableTypes, IJurisdictionRepository jurisdictions, IFormRepository forms, ITaxYearRepository taxYears, IQuarterRepository quarters, IQuarterDueDateRepository quarterDueDates, ISqlGenerator sqlGeneratorBase, IDataComparer datacomparer) { _connection = connection; Teams = teams; DueDates = duedates; Projects = projects; TaxPayerTypes = taxPayerTypes; DeliverableTypes = deliverableTypes; Jurisdictions = jurisdictions; Forms = forms; TaxYears = taxYears; Quarters = quarters; QuarterDueDates = quarterDueDates; Teams.ActionCreated += ActionCreated; DueDates.ActionCreated += ActionCreated; Projects.ActionCreated += ActionCreated; TaxPayerTypes.ActionCreated += ActionCreated; DeliverableTypes.ActionCreated += ActionCreated; Jurisdictions.ActionCreated += ActionCreated; Forms.ActionCreated += ActionCreated; TaxYears.ActionCreated += ActionCreated; Quarters.ActionCreated += ActionCreated; QuarterDueDates.ActionCreated += ActionCreated; _sqlGeneratorBase = sqlGeneratorBase; _dataComparer = datacomparer; ActionsQueue = new Queue <EntityAction>(); }
public static T[] ApplyMergeSort <T>(this T[] source, IDataComparer <T> comparer) { int size = source.Length; int maxLength = size - 1; int divideLength = 1; while (divideLength < size) { int startIdx = 0; bool isStopped = false; var newLength = divideLength * 2; while (!isStopped) { var start = startIdx; var end = startIdx + newLength - 1; var split = (end - start) / 2 + start; if (!source.IndexExists(split)) { split = maxLength; } if (!source.IndexExists(end)) { end = maxLength; } isStopped = end == maxLength; source.MergeByMinElements( start, split, end, comparer ); startIdx += newLength; } divideLength = newLength; } return(source); }
public static T[] ApplyBubbleSort <T>(this T[] source, IDataComparer <T> comparer) { bool isSorted = false; int lastUnsorted = source.Length - 1; while (!isSorted) { isSorted = true; for (int idx = 0; idx < lastUnsorted; idx++) { var item1 = source[idx]; var item2 = source[idx + 1]; if (comparer.Compare(item1, item2).IsFirstMore) { source.Swap(idx, idx + 1); isSorted = false; } } lastUnsorted--; } return(source); }
public static T[] ApplyHeapSort <T>(this T[] source, IDataComparer <T> comparer) { int length = source.Length; var index = length / 2 - 1; while (index >= 0) { source.BubbleDown(length, index, comparer); index--; } var end = length - 1; while (end >= 0) { source.Swap(0, end); source.BubbleDown(end, 0, comparer); end--; } return(source); }
public static bool BinarySearch <T>(this T[] arr, T item, IDataComparer <T> comparer) { int left = 0; int right = arr.Length - 1; while (left <= right) { int middle = (right - left) / 2 + left; var compareResult = comparer.Compare(item, arr[middle]); if (compareResult.IsEqual) { return(true); } if (compareResult.IsFirstLess) { right = middle - 1; } if (compareResult.IsFirstMore) { left = middle + 1; } } return(false); }
internal MyBottomComparer(IDataComparer comparer) { m_comparer = comparer; }
internal MyTopComparer(IDataComparer comparer) { m_comparer = comparer; }
public DueDateSqlGenerator(IDataComparer dataComparer) : base(dataComparer) { }
public MyTopComparer(IDataComparer comparer) { this.m_comparer = comparer; }
public TeamSqlGenerator(IDataComparer dataComparer) : base(dataComparer) { }
public MyBottomComparer(IDataComparer comparer) { this.m_comparer = comparer; }
public TaxYearSqlGenerator(IDataComparer dataComparer) : base(dataComparer) { }
public static void MergeByMinElements <T>(this T[] arr, int start, int split, int end, IDataComparer <T> comparer) { var buffer = new T[end - start + 1]; var firstIdx = start; var secondIdx = split + 1; int resIdx = 0; while (firstIdx <= split && secondIdx <= end) { if (comparer.Compare(arr[firstIdx], arr[secondIdx]).IsFirstMore) { buffer[resIdx] = arr[secondIdx]; secondIdx++; } else { buffer[resIdx] = arr[firstIdx]; firstIdx++; } resIdx++; } while (firstIdx <= split) { buffer[resIdx] = arr[firstIdx]; firstIdx++; resIdx++; } while (secondIdx <= end) { buffer[resIdx] = arr[secondIdx]; secondIdx++; resIdx++; } buffer.CopyTo(arr, start); }
public static IEnumerable <T> ApplyMergeSort <T>(this IEnumerable <T> source, IDataComparer <T> comparer) { return(ApplyMergeSort(source.ToArray(), comparer)); }
public BaseSqlGenerator(IDataComparer dataComparer) => _dataComparer = dataComparer;
public static bool BinarySearch <T>(this IEnumerable <T> arr, T item, IDataComparer <T> comparer) { return(arr.ToArray().BinarySearch(item, comparer)); }
internal Min(IDataComparer comparer) { m_currentMin = null; m_comparer = comparer; }
public Max(IDataComparer comparer) { this.m_currentMax = null; this.m_comparer = comparer; }