BcfIntSequence Class |
[This is preliminary documentation and is subject to change.]
Namespace: CalculationWorks.BusinessModel
The BcfIntSequence type exposes the following members.
Name | Description | |
---|---|---|
BcfIntSequence |
Creates a new instance.
|
Name | Description | |
---|---|---|
Accept |
Called when a value was applied (May be from out-side by setting a value or loading a row).
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Next |
Returns the next value from the sequence.
| |
Reset |
Resets the sequence to its initial state.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
public class BcfIntSequence : IBcfSequence<int> { private int _current; private readonly int _start; private readonly int _step; public BcfIntSequence(int start = 0, int step = 1) { if(step == 0) throw new ArgumentException("Zero is not a valid step.", nameof(step)); _start = start; _step = step; Reset(); } public int Next(BcfColumn<int> column) { _current += _step; return _current; } public void Accept(BcfColumn<int> column, int value) { if (_step > 0 && value > _current) _current = value; if (_step < 0 && value < _current) _current = value; } public void Reset() { _current = _start - _step; } }