public Intersection(BigInteger minValue, BigInteger maxValue, IEnumerable<BigInteger> sequenceRoots, BigInteger maxQuantity) { if (maxValue < minValue) { throw new ArgumentOutOfRangeException(paramName: "maxValue", message: "Parameter 'maxValue' cannot be less than parameter 'minValue'."); } if (sequenceRoots == null || sequenceRoots.Count() < 1) { throw new ArgumentOutOfRangeException(paramName: "sequenceRoots", message: "Parameter 'sequenceRoots' must contain at least one element."); } _minReturnValue = minValue; _maxReturnValue = maxValue; _maxReturnQuantity = maxQuantity; _coFactors = new List<BigInteger>(sequenceRoots); _quotientGroup = new QuotientGroup(_minReturnValue, _maxReturnValue, _coFactors, _maxReturnQuantity); }
public void Dispose() { if (!IsDisposed) { IsDisposed = true; if (_quotientGroup != null) { if (!_quotientGroup.IsDisposed) { _quotientGroup.Dispose(); } _quotientGroup = null; } if (_coFactors != null) { _coFactors.Clear(); _coFactors = null; } } }
public static void BreakMessage(QuotientGroup quotientGroup) { Console.WriteLine("-"); Console.ResetColor(); Console.Write("Value (max): {0:n0} ", quotientGroup._counterValue); Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("({0:n0})", quotientGroup._maxReturnValue); Console.ResetColor(); Console.Write("Iterations (max): {0:n0} ", quotientGroup._counterValuesReturned); Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("({0:n0})", quotientGroup._maxReturnQuantity); Console.ResetColor(); Console.WriteLine("-"); Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Divisions Performed: {0:n0}", quotientGroup.debugMetrics._counterDivisionOperations_Performed); Console.ResetColor(); Console.WriteLine("FirstLoopFailFast (OperationsSaved): {0:n0} ({1:n0})", quotientGroup.debugMetrics._counterFirstLoop_FailFast, quotientGroup.debugMetrics._counterFirstLoop_Skipped); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("PostYieldSkipped + FirstLoopSkipped = TotalSkipped: {0:n0} + {1:n0} = {2:n0}", quotientGroup.debugMetrics._counterDivisionOperations_PostYieldSkipped, quotientGroup.debugMetrics._counterFirstLoop_Skipped, quotientGroup.debugMetrics._counterDivisionOperations_TotalSkipped); Console.ResetColor(); Console.WriteLine(); }