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 intm_ColumnWidththe width of the columns.protected Stringm_MissingValuethe string to use for missing values.protected Stringm_SeparatorCellsthe separator to use for cells.protected Stringm_SeparatorHeaderthe 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 StringcolumnWidthTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.protected StringdoGenerateHeader(HeaderDefinition header)Performs the actual generation of the header data structure using the supplied header definition.protected StringdoGenerateRow(List data)Performs the actual generation of a row from the raw data.protected StringfixLength(String s, int max, boolean rightFill)Fixes the string to have the desired maximum length.intgetColumnWidth()Returns the column width.ClassgetDatasetFormat()Returns the class of the dataset that the converter generates.StringgetMissingValue()Returns the string to use for missing values.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.ClassgetRowFormat()Returns the class of the row that the converter generates.StringgetSeparatorCells()Returns the separator in use between cells.StringgetSeparatorHeader()Returns the separator in use between header and data.StringglobalInfo()Returns a string describing the object.StringmissingValueTipText()Returns the tip text for this property.StringseparatorCellsTipText()Returns the tip text for this property.StringseparatorHeaderTipText()Returns the tip text for this property.voidsetColumnWidth(int value)Sets the column width.voidsetMissingValue(String value)Sets the string to use for missing values.voidsetSeparatorCells(String value)Sets the separator to use between cells.voidsetSeparatorHeader(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:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin 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:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin 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:
getDatasetFormatin classAbstractFeatureConverter<String,String>- Returns:
- the format
-
getRowFormat
public Class getRowFormat()
Returns the class of the row that the converter generates.- Specified by:
getRowFormatin 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:
doGenerateHeaderin 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:
doGenerateRowin classAbstractFeatureConverter<String,String>- Parameters:
data- the data of the row, elements can be null (= missing)- Returns:
- the dataset structure
-
-