Package adams.data.featureconverter
Class FixedColumnText
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.featureconverter.AbstractFeatureConverter<String,String>
-
- adams.data.featureconverter.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 Summary
Fields Modifier and Type Field Description protected int
m_ColumnWidth
the width of the columns.protected String
m_MissingValue
the string to use for missing values.protected String
m_SeparatorCells
the separator to use for cells.protected String
m_SeparatorHeader
the separator between header and data (gets automatically repeated).-
Fields inherited from class adams.data.featureconverter.AbstractFeatureConverter
m_Dataset, m_Header, m_HeaderDefinition
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description FixedColumnText()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
columnWidthTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected String
doGenerateHeader(HeaderDefinition header)
Performs the actual generation of the header data structure using the supplied header definition.protected String
doGenerateRow(List data)
Performs the actual generation of a row from the raw data.protected String
fixLength(String s, int max, boolean rightFill)
Fixes the string to have the desired maximum length.int
getColumnWidth()
Returns the column width.Class
getDatasetFormat()
Returns the class of the dataset that the converter generates.String
getMissingValue()
Returns the string to use for missing values.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.Class
getRowFormat()
Returns the class of the row that the converter generates.String
getSeparatorCells()
Returns the separator in use between cells.String
getSeparatorHeader()
Returns the separator in use between header and data.String
globalInfo()
Returns a string describing the object.String
missingValueTipText()
Returns the tip text for this property.String
separatorCellsTipText()
Returns the tip text for this property.String
separatorHeaderTipText()
Returns the tip text for this property.void
setColumnWidth(int value)
Sets the column width.void
setMissingValue(String value)
Sets the string to use for missing values.void
setSeparatorCells(String value)
Sets the separator to use between cells.void
setSeparatorHeader(String value)
Sets the separator to use between header and data.-
Methods inherited from class adams.data.featureconverter.AbstractFeatureConverter
datasetTipText, generateHeader, generateRow, getDataset, getHeader, getHeaderDefinition, isInitialized, reset, setDataset
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
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.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractFeatureConverter<String,String>
-
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.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractFeatureConverter<String,String>
- Returns:
- null if no info available, otherwise short string
-
getDatasetFormat
public Class getDatasetFormat()
Returns the class of the dataset that the converter generates.- Specified by:
getDatasetFormat
in classAbstractFeatureConverter<String,String>
- Returns:
- the format
-
getRowFormat
public Class getRowFormat()
Returns the class of the row that the converter generates.- Specified by:
getRowFormat
in classAbstractFeatureConverter<String,String>
- Returns:
- the format
-
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 fixmax
- the maximum number of characters.rightFill
- whether to fill on the right- Returns:
- the fixed string
-
doGenerateHeader
protected String doGenerateHeader(HeaderDefinition header)
Performs the actual generation of the header data structure using the supplied header definition.- Specified by:
doGenerateHeader
in classAbstractFeatureConverter<String,String>
- Parameters:
header
- the header definition- Returns:
- the dataset structure
-
doGenerateRow
protected String doGenerateRow(List data)
Performs the actual generation of a row from the raw data.- Specified by:
doGenerateRow
in classAbstractFeatureConverter<String,String>
- Parameters:
data
- the data of the row, elements can be null (= missing)- Returns:
- the dataset structure
-
-