Class AbstractIndentifiableRowOperation
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.transformer.multispreadsheetoperation.AbstractMultiSpreadSheetOperation<SpreadSheet>
-
- adams.flow.transformer.multispreadsheetoperation.AbstractIndentifiableRowOperation
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
Difference
,Sum
public abstract class AbstractIndentifiableRowOperation extends AbstractMultiSpreadSheetOperation<SpreadSheet>
Identifies rows and then applies the actual operation to them.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]
m_ColIndices
the column indices to use.protected SpreadSheetColumnRange
m_KeyColumns
the range of column indices to use as key for identifying a row.protected RowIdentifier[]
m_Rows
for locating the rows.-
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 AbstractIndentifiableRowOperation()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
defineOptions()
Adds options to the internal list of options.protected SpreadSheet
doProcess(SpreadSheet[] sheets, MessageCollection errors)
Performs the actual processing of the sheets.protected void
generateOutputRow(SpreadSheet output, Row rowDiff)
Generates a row and appends it to the output.Class
generates()
Returns the class of objects that it generates.SpreadSheetColumnRange
getKeyColumns()
Returns the colums that identify a row, use empty string to simply use row indexString
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.protected void
initRowLookup(SpreadSheet[] sheets)
Initializes the row lookup, if necessary.String
keyColumnsTipText()
Returns the tip text for this property.int
maxNumSheetsRequired()
Returns the maximum number of sheets that are required for the operation.int
minNumSheetsRequired()
Returns the minimum number of sheets that are required for the operation.protected abstract Row
performOperation(SpreadSheet output, Row row1, Row row2)
Performs the actual operation on the rows.void
setKeyColumns(SpreadSheetColumnRange value)
Sets the colums that identify a row, use empty string to simply use row index.-
Methods inherited from class adams.flow.transformer.multispreadsheetoperation.AbstractMultiSpreadSheetOperation
check, process
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, 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_KeyColumns
protected SpreadSheetColumnRange m_KeyColumns
the range of column indices to use as key for identifying a row.
-
m_Rows
protected RowIdentifier[] m_Rows
for locating the rows.
-
m_ColIndices
protected int[] m_ColIndices
the column indices to use.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
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 classAbstractMultiSpreadSheetOperation<SpreadSheet>
- Returns:
- null if no info available, otherwise short string
-
minNumSheetsRequired
public int minNumSheetsRequired()
Returns the minimum number of sheets that are required for the operation.- Specified by:
minNumSheetsRequired
in classAbstractMultiSpreadSheetOperation<SpreadSheet>
- Returns:
- the number of sheets that are required, <= 0 means no lower limit
-
maxNumSheetsRequired
public int maxNumSheetsRequired()
Returns the maximum number of sheets that are required for the operation.- Specified by:
maxNumSheetsRequired
in classAbstractMultiSpreadSheetOperation<SpreadSheet>
- Returns:
- the number of sheets that are required, <= 0 means no upper limit
-
setKeyColumns
public void setKeyColumns(SpreadSheetColumnRange value)
Sets the colums that identify a row, use empty string to simply use row index.- Parameters:
value
- the range
-
getKeyColumns
public SpreadSheetColumnRange getKeyColumns()
Returns the colums that identify a row, use empty string to simply use row index- Returns:
- the range
-
keyColumnsTipText
public String keyColumnsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
generates
public Class generates()
Returns the class of objects that it generates.- Specified by:
generates
in classAbstractMultiSpreadSheetOperation<SpreadSheet>
- Returns:
- adams.core.io.SpreadSheet.class
-
initRowLookup
protected void initRowLookup(SpreadSheet[] sheets)
Initializes the row lookup, if necessary.- Parameters:
sheets
- the sheets to generated lookup for
-
performOperation
protected abstract Row performOperation(SpreadSheet output, Row row1, Row row2)
Performs the actual operation on the rows.- Parameters:
output
- the spreadsheet the new row will get added torow1
- the row from the first sheetrow2
- the row from the second sheet- Returns:
- the generated row
-
generateOutputRow
protected void generateOutputRow(SpreadSheet output, Row rowDiff)
Generates a row and appends it to the output.- Parameters:
output
- the spreadsheet to receive the outputrowDiff
- the difference row
-
doProcess
protected SpreadSheet doProcess(SpreadSheet[] sheets, MessageCollection errors)
Performs the actual processing of the sheets.- Specified by:
doProcess
in classAbstractMultiSpreadSheetOperation<SpreadSheet>
- Parameters:
sheets
- the containers to processerrors
- for collecting errors- Returns:
- the generated data
-
-