[JAMESII-368] Enhance CSVWriter handling of 2D arrays of primitives Created: 09/Jul/13 Updated: 13/Sep/13 Resolved: 13/Sep/13
|Fix Version/s:||James II 0.9.3|
|Security Level:||public (Visible to EVERYONE.)|
|Remaining Estimate:||0 minutes|
|Time Spent:||Not Specified|
|Original Estimate:||0 minutes|
The problem is that calling CSVWriter#writeResult with, for example, a double will write a single line with the double toString output, instead of the whole matrix (as would be expected).
|Comment by re027 [ 10/Jul/13 ]|
To reduce redundancy (the many writeResult(...) functions with different signatures) I am going to change CSVWriter from a utility singleton (containing only static methods) to a class with state, so that default parameters (delimiter etc.) can be set in the constructor(s).
|Comment by re027 [ 13/Sep/13 ]|
To avoid code duplication, several public methods have been removed from CSVWriter, e.g. all methods to append data to an existing file.
To do so, you can now use org.jamesii.core.util.misc.Files#appendToFiles, which can be easily combined with the CSVWriter, for example:
Additionally, the (seemingly unused?) method to store 1D arrays has been removed. This avoids to accidentally pass a 2D primitive array into it, although it cannot handle it.
Also, note that only the fully-configurable CSVWriter#writeResult(...) method is now available for 2D arrays of the eight primitive data types, to avoid code duplication.