Package weka.core.converters
Class ExcelSaver
- java.lang.Object
-
- weka.core.converters.AbstractSaver
-
- weka.core.converters.AbstractFileSaver
-
- weka.core.converters.ExcelSaver
-
- All Implemented Interfaces:
Serializable,weka.core.CapabilitiesHandler,weka.core.CapabilitiesIgnorer,weka.core.converters.BatchConverter,weka.core.converters.FileSourcedConverter,weka.core.converters.Saver,weka.core.EnvironmentHandler,weka.core.OptionHandler,weka.core.RevisionHandler
public class ExcelSaver extends weka.core.converters.AbstractFileSaver implements weka.core.converters.BatchConverterSaves Instances as MS Excel spreadsheet files.
Valid options are:-i <the input file> The input file
-o <the output file> The output file
-missing-value <string> The string to use for missing values). (default: blank)
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
Saver, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringm_MissingValueThe placeholder for missing values.protected Filem_OutputFilethe file to write to.-
Fields inherited from class weka.core.converters.AbstractFileSaver
m_env, m_incrementalCounter, m_useRelativePath
-
-
Constructor Summary
Constructors Constructor Description ExcelSaver()Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description weka.core.CapabilitiesgetCapabilities()Returns the Capabilities of this saver.StringgetFileDescription()Returns a description of the file type.StringgetFileExtension()Get the file extension used for this type of fileString[]getFileExtensions()Gets all the file extensions used for this type of fileStringgetMissingValue()Returns the current placeholder for missing values.String[]getOptions()returns the options of the current setupStringgetRevision()Returns the revision string.StringglobalInfo()Returns a string describing this SaverEnumerationlistOptions()Returns an enumeration describing the available options.static voidmain(String[] args)Main method.StringmissingValueTipText()Returns the tip text for this property.voidresetOptions()voidsetDestination(File file)Sets the destination file (and directories if necessary).voidsetDestination(OutputStream output)Default implementation throws an IOException.voidsetMissingValue(String value)Sets the placeholder for missing values.voidsetOptions(String[] options)Parses the options for this object.voidwriteBatch()Writes a Batch of instancesprotected voidwriteData(weka.core.Instances data, org.apache.poi.ss.usermodel.Workbook workbook)Writes the data to the workbook.-
Methods inherited from class weka.core.converters.AbstractFileSaver
cancel, filePrefix, getUseRelativePath, getWriter, makeOptionStr, resetWriter, retrieveDir, retrieveFile, runFileSaver, setDir, setDirAndPrefix, setEnvironment, setFile, setFileExtension, setFilePrefix, setUseRelativePath, useRelativePathTipText
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing this Saver- Returns:
- a description of the Saver suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceweka.core.OptionHandler- Overrides:
listOptionsin classweka.core.converters.AbstractFileSaver- Returns:
- an enumeration of all the available options.
-
setMissingValue
public void setMissingValue(String value)
Sets the placeholder for missing values.- Parameters:
value- the placeholder
-
getMissingValue
public String getMissingValue()
Returns the current placeholder for missing values.- Returns:
- the placeholder
-
missingValueTipText
public String missingValueTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
resetOptions
public void resetOptions()
- Overrides:
resetOptionsin classweka.core.converters.AbstractFileSaver
-
getOptions
public String[] getOptions()
returns the options of the current setup- Specified by:
getOptionsin interfaceweka.core.OptionHandler- Overrides:
getOptionsin classweka.core.converters.AbstractFileSaver- Returns:
- the current options
-
setOptions
public void setOptions(String[] options) throws Exception
Parses the options for this object.- Specified by:
setOptionsin interfaceweka.core.OptionHandler- Overrides:
setOptionsin classweka.core.converters.AbstractFileSaver- Parameters:
options- the options to use- Throws:
Exception- if setting of options fails
-
getFileDescription
public String getFileDescription()
Returns a description of the file type.- Specified by:
getFileDescriptionin interfaceweka.core.converters.FileSourcedConverter- Specified by:
getFileDescriptionin classweka.core.converters.AbstractFileSaver- Returns:
- a short file description
-
getFileExtension
public String getFileExtension()
Get the file extension used for this type of file- Specified by:
getFileExtensionin interfaceweka.core.converters.FileSourcedConverter- Specified by:
getFileExtensionin interfaceweka.core.converters.Saver- Overrides:
getFileExtensionin classweka.core.converters.AbstractFileSaver- Returns:
- the file extension
-
getFileExtensions
public String[] getFileExtensions()
Gets all the file extensions used for this type of file- Specified by:
getFileExtensionsin interfaceweka.core.converters.FileSourcedConverter- Overrides:
getFileExtensionsin classweka.core.converters.AbstractFileSaver- Returns:
- the file extensions
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns the Capabilities of this saver.- Specified by:
getCapabilitiesin interfaceweka.core.CapabilitiesHandler- Overrides:
getCapabilitiesin classweka.core.converters.AbstractSaver- Returns:
- the capabilities of this object
- See Also:
Capabilities
-
setDestination
public void setDestination(File file) throws IOException
Sets the destination file (and directories if necessary).- Specified by:
setDestinationin interfaceweka.core.converters.Saver- Overrides:
setDestinationin classweka.core.converters.AbstractFileSaver- Parameters:
file- the File- Throws:
IOException- always
-
setDestination
public void setDestination(OutputStream output) throws IOException
Default implementation throws an IOException.- Specified by:
setDestinationin interfaceweka.core.converters.Saver- Overrides:
setDestinationin classweka.core.converters.AbstractFileSaver- Parameters:
output- the OutputStream- Throws:
IOException- always
-
writeData
protected void writeData(weka.core.Instances data, org.apache.poi.ss.usermodel.Workbook workbook)Writes the data to the workbook.- Parameters:
data- the data to writeworkbook- the workbook to write to
-
writeBatch
public void writeBatch() throws IOExceptionWrites a Batch of instances- Specified by:
writeBatchin interfaceweka.core.converters.Saver- Specified by:
writeBatchin classweka.core.converters.AbstractSaver- Throws:
IOException- throws IOException if saving in batch mode is not possible
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceweka.core.RevisionHandler- Returns:
- the revision
-
main
public static void main(String[] args)
Main method.- Parameters:
args- should contain the options of a Saver.
-
-