|
||||||||||
| 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.data.conversion.AbstractConversion
adams.data.conversion.AbstractSpreadSheetConversion
adams.data.conversion.TransposeSpreadSheet
public class TransposeSpreadSheet
Transposes a spreadsheet, i.e., swaps columns with rows.
Valid options are:-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
-use-header-as-first-column (property: useHeaderAsFirstColumn) Whether to use the current header as first column.
-use-first-column-as-header (property: useFirstColumnAsHeader) Whether to use the first column as new header.
-column-prefix <java.lang.String> (property: columnPrefix) The column prefix for the new columns if the first column is not used for the header; 1-based column index is appended. default: col-
| Field Summary | |
|---|---|
protected String |
m_ColumnPrefix
the column prefix if the first column is not used as header. |
protected boolean |
m_UseFirstColumnAsHeader
whether to use the first column as header. |
protected boolean |
m_UseHeaderAsFirstColumn
whether to add the header row as first column. |
| 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_DebugLevel, m_OptionManager |
| Constructor Summary | |
|---|---|
TransposeSpreadSheet()
|
|
| Method Summary | |
|---|---|
String |
columnPrefixTipText()
Returns the tip text for this property. |
protected SpreadSheet |
convert(SpreadSheet input)
Performs the actual conversion. |
void |
defineOptions()
Adds options to the internal list of options. |
String |
getColumnPrefix()
Returns whether to use the first column as new header. |
boolean |
getUseFirstColumnAsHeader()
Returns whether to use the first column as new header. |
boolean |
getUseHeaderAsFirstColumn()
Returns whether to use the current header as first column. |
String |
globalInfo()
Returns a string describing the object. |
void |
setColumnPrefix(String value)
Sets the column prefix if the first column is not used as header. |
void |
setUseFirstColumnAsHeader(boolean value)
Sets whether to use the first column as new header. |
void |
setUseHeaderAsFirstColumn(boolean value)
Sets whether to use the current header as first column. |
protected Object[][] |
transpose(Object[][] matrix)
Transposes the matrix. |
String |
useFirstColumnAsHeaderTipText()
Returns the tip text for this property. |
String |
useHeaderAsFirstColumnTipText()
Returns the tip text for this property. |
| Methods inherited from class adams.data.conversion.AbstractSpreadSheetConversion |
|---|
accepts, doConvert, generates |
| Methods inherited from class adams.data.conversion.AbstractConversion |
|---|
checkData, cleanUp, convert, getInput, getOutput, getOwner, getQuickInfo, reset, setInput, setOwner, shallowCopy, shallowCopy, stopExecution |
| Methods inherited from class adams.core.option.AbstractOptionHandler |
|---|
cleanUpOptions, debug, debug, debugLevelTipText, destroy, finishInit, getDebugLevel, getOptionManager, initialize, isDebugOn, newOptionManager, setDebugLevel, toCommandLine, toString |
| Methods inherited from class adams.core.ConsoleObject |
|---|
getDebugging, getSystemErr, getSystemOut, sizeOf |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected boolean m_UseHeaderAsFirstColumn
protected boolean m_UseFirstColumnAsHeader
protected String m_ColumnPrefix
| Constructor Detail |
|---|
public TransposeSpreadSheet()
| Method Detail |
|---|
public String globalInfo()
globalInfo in class AbstractOptionHandlerpublic void defineOptions()
defineOptions in interface OptionHandlerdefineOptions in class AbstractOptionHandlerpublic void setUseHeaderAsFirstColumn(boolean value)
value - true if to use headerpublic boolean getUseHeaderAsFirstColumn()
public String useHeaderAsFirstColumnTipText()
public void setUseFirstColumnAsHeader(boolean value)
value - true if to use columnpublic boolean getUseFirstColumnAsHeader()
public String useFirstColumnAsHeaderTipText()
public void setColumnPrefix(String value)
value - the prefixpublic String getColumnPrefix()
public String columnPrefixTipText()
protected Object[][] transpose(Object[][] matrix)
matrix - the matrix to transose
protected SpreadSheet convert(SpreadSheet input)
throws Exception
+----+----+----+ | c1 | c2 | c3 | +====+====+====+ | A | B | C | +----+----+----+ | D | E | F | +----+----+----+
m_UseFirstColumnAsHeader = FAH m_HeaderAsFirstColumn = HAF!FAH & !HAF:
+----+----+ | P1 | P2 | +====+====+ | A | D | +----+----+ | B | E | +----+----+ | C | F | +----+----+FAH & !HAF:
+----+----+ | A | D | +====+====+ | B | E | +----+----+ | C | F | +----+----+!FAH & HAF:
+----+----+----+ | P1 | P2 | P3 | +====+====+====+ | c1 | A | D | +----+----+----+ | c2 | B | E | +----+----+----+ | c3 | C | F | +----+----+----+FAH & HAF:
+----+----+----+ | c1 | A | D | +====+====+====+ | c2 | B | E | +----+----+----+ | c3 | C | F | +----+----+----+
convert in class AbstractSpreadSheetConversioninput - the incoming spreadsheet
Exception - if something goes wrong with the conversion
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||