private Incrementor(Incrementor related, int min, int max, int increment, int currentValue) { _related = related; Minimum = min; Maximum = max; Increment = increment; Value = currentValue; CanIncrement = IsIncrementable(); }
public Incrementor IncrementValue() { if (!CanIncrement) { throw new InvalidOperationException(); } if (Value == Maximum) { if (_related != null) { _related = _related.IncrementValue(); } return(new Incrementor(_related, Minimum, Maximum, Increment)); } return(new Incrementor(_related, Minimum, Maximum, Increment, Value + Increment)); }
public Incrementor SetParent(Incrementor parentIncrementor) { return(new Incrementor(parentIncrementor, Minimum, Maximum, Increment)); }
public Incrementor(Incrementor related, int min, int max, int increment = 1) : this(related, min, max, increment, min) { }