AutoFillSerial support for text. #63
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Jing,
Here's the pull request for #61. Support for text-cells, yay! :-)
AutoFill behavior has slightly changed in this PR. This is intentional, as I believe it's for the better. Of course it's your project, so please review the new behavior and let me know if you agree with it or not. You can quickly view the "AutoFillSerialInputOutputTestDataProvider" method in the unit-test-class. There's a lot of I/O testing described in there.
Big picture of the solution:
Future benefits:
It should be relatively easy to refactor this a bit more to support custom AutoFillSectionEntries. All that's needed is the ability to customize for the AutoFillSectionEntryFactory from externally. Then the user can add his own data types and extrapolation logic.
Notable Differences:
You may remember this remark in #61
[1],[4],[2],[5],[3],[6]. With an avarage increase of 1 per cell I would've expected: [4],[7],[5],[8],[6],[9]. But instead Reogrid produces: [9,625][12,625][10,625][13,625][11,625][14,625]. The pattern is there, but the calculation of the avarage increase per cell is bust.
You can now see in the unit-test it produces "7, 10, 8, 11, 9, 12, 13, 16, 14".
Over a span of 6 cells, the value increased from 1 to 6, which avarages to 1-per-cell. The pattern then repeats after 6 cells. Meaning it starts with:
<BaseValue (1)> + <AvgPerCell(1)> * <length of the pattern (6) = 7.
After that the new basevalue is 7, en the rest will be added/substracted based on the differences in the pattern.
So the comma-values is fixed. But repeats patterns, it does not continue patterns.
Another difference would be the workings of sections. Take for instance:
1, 2, null, 3, 4, null
You might expect it to continue as
5, 6, null, 7, 8, null
Instead, because the null is in the middle, it counts as 2 separate sections, which calculate it's diff and extrapolate independently. So it'll continue as:
3, 4, null, 5, 6, null, 5, 6, null, 7, 8, null
So this last one I'm not too sure if you like it. It makes sense to me from technical stance. After all, there's an empty cell, so why wouldn't it be separate sequences? But I don't know if you and your userbase appreciate the technical stance on this.
I might be able to fix this for null-cells. But when instead the pattern becomes:
1,2,SomeText,3,4,SomeText
it'll become vague. So I actually rather not work around it, unless you think it's a must.
My expectation on the grand scale is that these tricky patterns are rare anyway. :-)
Love to hear what you think!