Package jasima.core.util
Class ExcelSaver
- java.lang.Object
-
- jasima.core.util.AbstractResultSaver
-
- jasima.core.util.ResultSaver
-
- jasima.core.util.ExcelSaver
-
- All Implemented Interfaces:
ExperimentListener,NotifierListener<Experiment,Experiment.ExperimentEvent>
public class ExcelSaver extends ResultSaver
Saves results of an experiment in a handy excel file. The data is stored in a file named like "runResults_2009-08-27_164340.xls". The timestamp in this name is the time the method saveAsExcel() was first called.
This class stores final results of an experiment as well as results of any sub-experiments.
This class supports more than 256 columns per sheet (Excel-Limit) by splitting data on multiple sheets.
Data can be transposed when stored, i.e., rows and columns swapped.
- Author:
- Torsten Hildebrandt, 2009-08-27
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jasima.core.util.ResultSaver
ResultSaver.CellData, ResultSaver.ColumnData
-
Nested classes/interfaces inherited from interface jasima.core.experiment.ExperimentListener
ExperimentListener.AfterRunListener, ExperimentListener.BeforeRunListener, ExperimentListener.DoneListener, ExperimentListener.ErrorListener, ExperimentListener.FinallyListener, ExperimentListener.FinishedListener, ExperimentListener.FinishingListener, ExperimentListener.HandleOtherListener, ExperimentListener.InitializedListener, ExperimentListener.MultiExperimentCompletedTaskListener, ExperimentListener.PrintListener, ExperimentListener.ProduceResultsListener, ExperimentListener.RunPerformedListener, ExperimentListener.StartingListener
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_COLUMNSstatic intMAX_ROWSstatic StringXLS_EXTENSION-
Fields inherited from class jasima.core.util.ResultSaver
SER_EXTENSION
-
-
Constructor Summary
Constructors Constructor Description ExcelSaver()ExcelSaver(String fileNameHint)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckBaseName(String base)voidconvertFile(File in, File out)protected voidconvertToExcelFile(ObjectInputStream is, OutputStream os)voidfinished(Experiment e, Map<String,Object> results)intgetMaxParamValues()intgetMaxStringLength()booleanisKeepDataFile()booleanisTranspose()static voidmain(String[] args)This main method can be used to manually convert a.jasResBinfile to Excel format.protected voidreadColumns(ObjectInputStream is)Reads column names and values of parameter columns.voidsetKeepDataFile(boolean keepDataFile)If set, the (binary) result file produced by the parent classResultSaveris not deleted after successfully creating an Excel file from it (default: false, i.e., the file is deleted).voidsetMaxParamValues(int maxParamValues)Sets the maximum number of parameters values shown on sheet "sub-exp. overview".voidsetMaxStringLength(int maxStringLength)Sets the maximum length of a String (to save space and increase readability).voidsetTranspose(boolean transpose)Change columns/rows.-
Methods inherited from class jasima.core.util.ResultSaver
flushTmpFile, isSaveSubExperiments, multiExperimentCompletedTask, setSaveSubExperiments, starting
-
Methods inherited from class jasima.core.util.AbstractResultSaver
findFreeFile, findFreeFile, getActualResultBaseName, getFileNameHint, setFileNameHint, setResultFileName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jasima.core.experiment.ExperimentListener
afterRun, beforeRun, done, error, finalAction, finishing, handleOther, inform, initialized, print, produceResults, runPerformed
-
-
-
-
Field Detail
-
XLS_EXTENSION
public static final String XLS_EXTENSION
- See Also:
- Constant Field Values
-
MAX_ROWS
public static final int MAX_ROWS
- See Also:
- Constant Field Values
-
MAX_COLUMNS
public static final int MAX_COLUMNS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExcelSaver
public ExcelSaver()
-
ExcelSaver
public ExcelSaver(String fileNameHint)
-
-
Method Detail
-
main
public static void main(String[] args)
This main method can be used to manually convert a.jasResBinfile to Excel format.- Parameters:
args- The list of command line arguments.
-
convertFile
public void convertFile(File in, File out) throws IOException
- Throws:
IOException
-
finished
public void finished(Experiment e, Map<String,Object> results)
- Specified by:
finishedin interfaceExperimentListener- Overrides:
finishedin classResultSaver
-
checkBaseName
public boolean checkBaseName(String base)
- Overrides:
checkBaseNamein classResultSaver
-
convertToExcelFile
protected void convertToExcelFile(ObjectInputStream is, OutputStream os)
-
readColumns
protected void readColumns(ObjectInputStream is)
Reads column names and values of parameter columns.- Parameters:
is- The input file which is read till the end.
-
isTranspose
public boolean isTranspose()
-
setTranspose
public void setTranspose(boolean transpose)
Change columns/rows.
-
isKeepDataFile
public boolean isKeepDataFile()
-
setKeepDataFile
public void setKeepDataFile(boolean keepDataFile)
If set, the (binary) result file produced by the parent classResultSaveris not deleted after successfully creating an Excel file from it (default: false, i.e., the file is deleted).- Parameters:
keepDataFile- Whether or not to keep the raw binary file created before conversion to Excel format.
-
getMaxParamValues
public int getMaxParamValues()
-
setMaxParamValues
public void setMaxParamValues(int maxParamValues)
Sets the maximum number of parameters values shown on sheet "sub-exp. overview". Set this to 0 for no limit (default is: 20).- Parameters:
maxParamValues- Sets the maximum number of parameters values shown on overview sheet.
-
getMaxStringLength
public int getMaxStringLength()
-
setMaxStringLength
public void setMaxStringLength(int maxStringLength)
Sets the maximum length of a String (to save space and increase readability). Set this to 0 for no limit (default is: 500).- Parameters:
maxStringLength- The maximum length of a cell value.
-
-