FieldFormat holds all the formatting info needed to format data values in a specific column. e.g. Field 1 may be text, field 2 may be a float, etc. This is calculated during the caching phase. Each FieldFormat instance is part of a vector representing the full row, so each includes the start position on the line and similar data.
APIs used during the caching phase to gather field value samples - this - Initial construction. Takes the field index. - setHeader - Used to set the header text. - updateForFieldValue - Used to add the next field value sample. - finalizeFormatting - Used at the end of caching to finalize the format choices.
APIs used after caching is finished (after finalizeFormatting): - startPosition - Returns the expected start position for the field. - endPosition - Returns the expected end position for the field. - writeHeader - Outputs the header, properly aligned. - writeFieldValue - Outputs the current field value, properly aligned.
Initial construction. Takes a field index.
Returns the expected end position for the field.
Returns the type of field.
Updates field formatting info based on the current state. It is expected to be called after adding field entries via updateForFieldValue(). It returns its new end position.
Sets the header text.
Returns the expected start position for the field.
Updates type and format given a new field value.
Writes the field value for the current column.
Writes the field header or underline characters to the output stream.