Class FixedColumnText

  • All Implemented Interfaces:
    Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, SizeOfHandler, Serializable

    public class FixedColumnText
    extends AbstractFeatureConverter<String,​String>
    Simple feature converter that generates textual output with fixed column width.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -column-width <int> (property: columnWidth)
        The width of a column in characters.
        default: 10
        minimum: 1
     
    -separator-cells <java.lang.String> (property: separatorCells)
        The separator to use between cells.
        default:  | 
     
    -separator-header <java.lang.String> (property: separatorHeader)
        The separator to use between header and data.
        default: -
     
    -missing-value <java.lang.String> (property: missingValue)
        The value to use for missing values.
        default: 
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_ColumnWidth

        protected int m_ColumnWidth
        the width of the columns.
      • m_SeparatorCells

        protected String m_SeparatorCells
        the separator to use for cells.
      • m_SeparatorHeader

        protected String m_SeparatorHeader
        the separator between header and data (gets automatically repeated).
      • m_MissingValue

        protected String m_MissingValue
        the string to use for missing values.
    • Constructor Detail

      • FixedColumnText

        public FixedColumnText()
    • Method Detail

      • setColumnWidth

        public void setColumnWidth​(int value)
        Sets the column width.
        Parameters:
        value - the width
      • getColumnWidth

        public int getColumnWidth()
        Returns the column width.
        Returns:
        the width
      • columnWidthTipText

        public String columnWidthTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setSeparatorCells

        public void setSeparatorCells​(String value)
        Sets the separator to use between cells.
        Parameters:
        value - the separator
      • getSeparatorCells

        public String getSeparatorCells()
        Returns the separator in use between cells.
        Returns:
        the separator
      • separatorCellsTipText

        public String separatorCellsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setSeparatorHeader

        public void setSeparatorHeader​(String value)
        Sets the separator to use between header and data. Gets automatically repeated to fill up row.
        Parameters:
        value - the separator
      • getSeparatorHeader

        public String getSeparatorHeader()
        Returns the separator in use between header and data. Gets automatically repeated to fill up row.
        Returns:
        the separator
      • separatorHeaderTipText

        public String separatorHeaderTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setMissingValue

        public void setMissingValue​(String value)
        Sets the string to use for missing values.
        Parameters:
        value - the missing value string
      • getMissingValue

        public String getMissingValue()
        Returns the string to use for missing values.
        Returns:
        the missing value string
      • missingValueTipText

        public String missingValueTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • fixLength

        protected String fixLength​(String s,
                                   int max,
                                   boolean rightFill)
        Fixes the string to have the desired maximum length. Uses blanks to fill up.
        Parameters:
        s - the string to fix
        max - the maximum number of characters.
        rightFill - whether to fill on the right
        Returns:
        the fixed string
      • doGenerateRow

        protected String doGenerateRow​(List data)
        Performs the actual generation of a row from the raw data.
        Specified by:
        doGenerateRow in class AbstractFeatureConverter<String,​String>
        Parameters:
        data - the data of the row, elements can be null (= missing)
        Returns:
        the dataset structure