|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectadams.core.ConsoleObject
adams.core.option.AbstractOptionHandler
adams.flow.core.AbstractActor
adams.flow.transformer.AbstractTransformer
adams.flow.transformer.SpreadSheetMerge
public class SpreadSheetMerge
Merges two or more spreadsheets. The merge can be done by using a common key-column or by simply putting the spreadsheets side-by-side.
Input/output:-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-name <java.lang.String> (property: name) The name of the actor. default: SpreadSheetMerge
-annotation <adams.core.base.BaseText> (property: annotations) The annotations to attach to this actor. default:
-skip (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is.
-stop-flow-on-error (property: stopFlowOnError) If set to true, the flow gets stopped in case this actor encounters an error; useful for critical actors.
-use-prefix (property: usePrefix) Whether to prefix the attribute names of each dataset with an index and an optional string.
-add-index (property: addIndex) Whether to add the index of the dataset to the prefix.
-remove (property: remove) If true, only keep instances where data is available from each source.
-prefix <java.lang.String> (property: prefix) The optional prefix string to prefix the index number with (in case prefixes are used). default: dataset
-prefix-separator <java.lang.String> (property: prefixSeparator) The separator string between the generated prefix and the original attribute name. default: -
-exclude-atts <java.lang.String> (property: excludedAttributes) The regular expression used on the attribute names, to determine whether an attribute should be excluded or not (matching sense can be inverted); leave empty to include all attributes. default:
-invert (property: invertMatchingSense) Whether to invert the matching sense of excluding attributes, ie, the regular expression is used for including attributes.
-unique-id <java.lang.String> (property: uniqueID) The name of the column used for uniquely identifying rows among the spreadsheets. default:
| Field Summary | |
|---|---|
protected boolean |
m_AddIndex
whether to add the index to the prefix. |
protected String |
m_ExcludedAttributes
regular expression for excluding attributes from the datasets. |
protected boolean |
m_InvertMatchingSense
whether to invert the matching sense for excluding attributes. |
protected String |
m_Prefix
the additional prefix name to use, apart from the index. |
protected String |
m_PrefixSeparator
the separator between index and actual attribute name. |
protected boolean |
m_Remove
whether to remove when not all present. |
protected String |
m_UniqueID
the string or numeric attribute to use as unique identifier for rows. |
protected boolean |
m_UsePrefix
whether to prefix the attribute names of each dataset with an index. |
| Fields inherited from class adams.flow.transformer.AbstractTransformer |
|---|
BACKUP_INPUT, BACKUP_OUTPUT, m_InputToken, m_OutputToken |
| Fields inherited from class adams.flow.core.AbstractActor |
|---|
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_Headless, m_Name, m_Parent, m_Root, m_ScopeHandler, m_Self, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated |
| Fields inherited from class adams.core.option.AbstractOptionHandler |
|---|
m_DebugLevel, m_OptionManager |
| Fields inherited from interface adams.flow.core.Actor |
|---|
FILE_EXTENSION, FILE_EXTENSION_GZ |
| Constructor Summary | |
|---|---|
SpreadSheetMerge()
|
|
| Method Summary | |
|---|---|
Class[] |
accepts()
Returns the class that the consumer accepts. |
String |
addIndexTipText()
Returns the tip text for this property. |
protected String |
createPrefix(int index)
Generates the prefix string. |
void |
defineOptions()
Adds options to the internal list of options. |
protected String |
doExecute()
Executes the flow item. |
protected SpreadSheet |
excludeAttributes(SpreadSheet sheet)
Excludes columns from the data. |
String |
excludedAttributesTipText()
Returns the tip text for this property. |
Class[] |
generates()
Returns the class of objects that it generates. |
boolean |
getAddIndex()
Returns whether to add the dataset index number to the prefix. |
String |
getExcludedAttributes()
Returns the prefix separator string. |
boolean |
getInvertMatchingSense()
Returns whether to invert the matching sense. |
String |
getPrefix()
Returns the optional prefix string. |
String |
getPrefixSeparator()
Returns the prefix separator string. |
String |
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI. |
boolean |
getRemove()
Returns whether to remove if not all present |
String |
getUniqueID()
Returns the attribute (string/numeric) to use for uniquely identifying rows. |
boolean |
getUsePrefix()
Returns whether to use prefixes. |
String |
globalInfo()
Returns a string describing the object. |
String |
invertMatchingSenseTipText()
Returns the tip text for this property. |
protected SpreadSheet |
merge(SpreadSheet[] orig,
SpreadSheet[] inst,
HashSet ids)
Merges the datasets based on the collected IDs. |
protected SpreadSheet |
prefixColumns(SpreadSheet inst,
int index)
Prefixes the columns. |
String |
prefixSeparatorTipText()
Returns the tip text for this property. |
String |
prefixTipText()
Returns the tip text for this property. |
protected SpreadSheet |
prepareData(SpreadSheet inst,
int index)
Prepares the data, prefixing columns, removing columns, etc, before merging it. |
String |
removeTipText()
Returns the tip text for this property. |
void |
setAddIndex(boolean value)
Sets whether to add the dataset index number to the prefix. |
void |
setExcludedAttributes(String value)
Sets the regular expression for excluding attributes. |
void |
setInvertMatchingSense(boolean value)
Sets whether to invert the matching sense. |
void |
setPrefix(String value)
Sets the optional prefix string. |
void |
setPrefixSeparator(String value)
Sets the prefix separator string. |
void |
setRemove(boolean value)
Sets whether to remove if not all present |
void |
setUniqueID(String value)
Sets the attribute (string/numeric) to use for uniquely identifying rows. |
void |
setUsePrefix(boolean value)
Sets whether to use prefixes. |
String |
uniqueIDTipText()
Returns the tip text for this property. |
protected void |
updateIDs(SpreadSheet inst,
HashSet ids)
Updates the IDs in the hashset with the ones stored in the ID column of the provided spreadsheet. |
String |
usePrefixTipText()
Returns the tip text for this property. |
| Methods inherited from class adams.flow.transformer.AbstractTransformer |
|---|
backupState, execute, hasPendingOutput, input, output, postExecute, reset, restoreState, wrapUp |
| Methods inherited from class adams.core.option.AbstractOptionHandler |
|---|
cleanUpOptions, debug, debugLevelTipText, finishInit, getDebugLevel, getOptionManager, isDebugOn, newOptionManager, setDebugLevel, toCommandLine, toString |
| Methods inherited from class adams.core.ConsoleObject |
|---|
getDebugging, getSystemErr, getSystemOut |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface adams.flow.core.Actor |
|---|
cleanUp, compareTo, debug, destroy, equals, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setHeadless, setName, setParent, setSkip, setStopFlowOnError, setUp, setVariables, sizeOf, stopExecution, stopExecution, variableChanged |
| Methods inherited from interface adams.core.AdditionalInformationHandler |
|---|
getAdditionalInformation |
| Methods inherited from interface adams.core.option.OptionHandler |
|---|
cleanUpOptions, getOptionManager |
| Field Detail |
|---|
protected boolean m_UsePrefix
protected boolean m_AddIndex
protected boolean m_Remove
protected String m_Prefix
protected String m_PrefixSeparator
protected String m_ExcludedAttributes
protected boolean m_InvertMatchingSense
protected String m_UniqueID
| Constructor Detail |
|---|
public SpreadSheetMerge()
| Method Detail |
|---|
public String globalInfo()
globalInfo in class AbstractOptionHandlerpublic void defineOptions()
defineOptions in interface OptionHandlerdefineOptions in class AbstractActorpublic void setRemove(boolean value)
value - if true then remove instance if not all there to mergepublic boolean getRemove()
public String removeTipText()
public void setUsePrefix(boolean value)
value - if true then the attributes will get prefixedpublic boolean getUsePrefix()
public String usePrefixTipText()
public void setAddIndex(boolean value)
value - if true then the index will be used in the prefixpublic boolean getAddIndex()
public String addIndexTipText()
public void setPrefix(String value)
value - the optional prefix stringpublic String getPrefix()
public String prefixTipText()
public void setPrefixSeparator(String value)
value - the prefix separator stringpublic String getPrefixSeparator()
public String prefixSeparatorTipText()
public void setExcludedAttributes(String value)
value - the regular expressionpublic String getExcludedAttributes()
public String excludedAttributesTipText()
public void setInvertMatchingSense(boolean value)
value - if true then matching sense gets invertedpublic boolean getInvertMatchingSense()
public String invertMatchingSenseTipText()
public void setUniqueID(String value)
value - the attribute namepublic String getUniqueID()
public String uniqueIDTipText()
public String getQuickInfo()
getQuickInfo in interface QuickInfoSupportergetQuickInfo in interface ActorgetQuickInfo in class AbstractActorpublic Class[] accepts()
public Class[] generates()
protected SpreadSheet excludeAttributes(SpreadSheet sheet)
index - the index of the spreadsheetsheet - the data to process
protected String createPrefix(int index)
index - the index of the spreadsheet to produce the prefix for
protected SpreadSheet prefixColumns(SpreadSheet inst,
int index)
index - the index of the spreadsheetinst - the data to process
protected SpreadSheet prepareData(SpreadSheet inst,
int index)
inst - the data to processindex - the 0-based index of the dataset being processed
protected void updateIDs(SpreadSheet inst,
HashSet ids)
inst - the spreadsheet to obtain the IDs fromids - the hashset to store the IDs in
protected SpreadSheet merge(SpreadSheet[] orig,
SpreadSheet[] inst,
HashSet ids)
orig - the original datasetsinst - the processed datasets to merge into oneids - the IDs for identifying the rows
protected String doExecute()
doExecute in class AbstractActor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||