public CoolDownStrategy(TimeSpan max, TimeSpan constant, TimeSpan coefficient, double exponentiationBase) { if (coefficient == TimeSpan.Zero) { _calculateCoolDown = (consecutiveFails) => Constant(constant); } else if (exponentiationBase < 1.001 && exponentiationBase > 0.999) { _calculateCoolDown = (consecutiveFails) => Linear(consecutiveFails, max, constant, coefficient); } else { _calculateCoolDown = (consecutiveFails) => Exponential(consecutiveFails, max, constant, coefficient, exponentiationBase); } Reset(); }
public CoolDownStrategy(CalculateCoolDownDelegate calculateCoolDown) { _calculateCoolDown = calculateCoolDown; }