Package adams.data.conversion
Class SpreadSheetAddRowID
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<AbstractConversion>
,SizeOfHandler
,Stoppable
,Conversion
,InPlaceProcessing
,Serializable
public class SpreadSheetAddRowID extends AbstractInPlaceSpreadSheetConversion
Adds an ID column to the spreadsheet, using the row index as value.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-no-copy <boolean> (property: noCopy) If enabled, no copy of the spreadsheet is created before processing it. default: false
-header <java.lang.String> (property: header) The name of the new column. default: ID
-position <adams.data.spreadsheet.SpreadSheetColumnIndex> (property: position) The position where to insert the ID column. default: first example: An index is a number starting with 1; apart from column names (case-sensitive), the following placeholders can be used as well: first, second, third, last_2, last_1, last
-after <boolean> (property: after) If enabled, the ID column is inserted after the position instead of at the position. default: false
-start <int> (property: start) The first ID to use. default: 1
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_After
whether to insert after the position instead of at.protected String
m_Header
the column header.protected SpreadSheetColumnIndex
m_Position
the position where to insert the column.protected int
m_Start
the index to start with.-
Fields inherited from class adams.data.conversion.AbstractInPlaceSpreadSheetConversion
m_NoCopy
-
Fields inherited from class adams.data.conversion.AbstractConversion
m_Input, m_Output, m_Owner, m_Stopped
-
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 SpreadSheetAddRowID()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
afterTipText()
Returns the tip text for this property.protected SpreadSheet
convert(SpreadSheet input)
Generates the new spreadsheet from the input.void
defineOptions()
Adds options to the internal list of options.boolean
getAfter()
Returns whether to insert at or after the position.String
getHeader()
Returns the name of the column.SpreadSheetColumnIndex
getPosition()
Returns the position where to insert the column.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.int
getStart()
Returns the start of the row ID.String
globalInfo()
Returns a string describing the object.String
headerTipText()
Returns the tip text for this property.protected void
initialize()
Initializes the members.String
positionTipText()
Returns the tip text for this property.void
setAfter(boolean value)
Sets whether to insert at or after the position.void
setHeader(String value)
Sets the name of the column.void
setPosition(SpreadSheetColumnIndex value)
Sets the position where to insert the column.void
setStart(int value)
Sets the first row ID to use.String
startTipText()
Returns the tip text for this property.-
Methods inherited from class adams.data.conversion.AbstractInPlaceSpreadSheetConversion
getNoCopy, noCopyTipText, setNoCopy
-
Methods inherited from class adams.data.conversion.AbstractSpreadSheetConversion
accepts, doConvert, generates
-
Methods inherited from class adams.data.conversion.AbstractConversion
checkData, cleanUp, convert, getAdditionalInformation, getInput, getInput, getOutput, getOutput, getOwner, reset, setInput, setOwner, shallowCopy, shallowCopy, stopExecution
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, 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_Header
protected String m_Header
the column header.
-
m_Position
protected SpreadSheetColumnIndex m_Position
the position where to insert the column.
-
m_After
protected boolean m_After
whether to insert after the position instead of at.
-
m_Start
protected int m_Start
the index to start with.
-
-
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 classAbstractInPlaceSpreadSheetConversion
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractOptionHandler
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractConversion
- Returns:
- null if no info available, otherwise short string
-
setHeader
public void setHeader(String value)
Sets the name of the column.- Parameters:
value
- the name
-
getHeader
public String getHeader()
Returns the name of the column.- Returns:
- the name
-
headerTipText
public String headerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPosition
public void setPosition(SpreadSheetColumnIndex value)
Sets the position where to insert the column.- Parameters:
value
- the position
-
getPosition
public SpreadSheetColumnIndex getPosition()
Returns the position where to insert the column.- Returns:
- the position
-
positionTipText
public String positionTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAfter
public void setAfter(boolean value)
Sets whether to insert at or after the position.- Parameters:
value
- true if to add after
-
getAfter
public boolean getAfter()
Returns whether to insert at or after the position.- Returns:
- true if to add after
-
afterTipText
public String afterTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setStart
public void setStart(int value)
Sets the first row ID to use.- Parameters:
value
- the ID start
-
getStart
public int getStart()
Returns the start of the row ID.- Returns:
- the ID start
-
startTipText
public String startTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
convert
protected SpreadSheet convert(SpreadSheet input) throws Exception
Generates the new spreadsheet from the input.- Specified by:
convert
in classAbstractSpreadSheetConversion
- Parameters:
input
- the incoming spreadsheet- Returns:
- the generated spreadsheet
- Throws:
Exception
- if conversion fails for some reason
-
-