/// <summary> /// Initializes a new instance of the <see cref="Patcher"/> class. /// </summary> /// <param name="immutableArray">Immutable array of samples.</param> /// <param name="patchCollection">Collection of patches.</param> /// <param name="updateFunc">Function to call to get the patched value. /// Example: (patch, position) => patch.GetOutputSample(position).</param> public Patcher( ImmutableArray <double> immutableArray, PatchCollection patchCollection, Func <AbstractPatch, int, double> updateFunc) { this.immutableArray = immutableArray; this.patchCollection = patchCollection; this.updateFunc = updateFunc; }
public void Setup() { _arrayValueEqualsIndex = Enumerable.Range(0, _testArrayLength) .Select(i => (double)i) .ToImmutableArray(); _patchCollection = new PatchCollection(); _patcher = new Patcher( _arrayValueEqualsIndex, _patchCollection, (patch, position) => patch.GetValue(position)); }