Package weka.core.converters
Class SpreadSheetSaver
- java.lang.Object
-
- weka.core.converters.AbstractSaver
-
- weka.core.converters.AbstractFileSaver
-
- weka.core.converters.SpreadSheetSaver
-
- 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 SpreadSheetSaver extends weka.core.converters.AbstractFileSaver implements weka.core.converters.BatchConverter
Writes the Instances to a spreadsheet file using the specified ADAMS spreadsheet writer.
Valid options are:
-i <the input file> The input file
-o <the output file> The output file
-writer <classname + options> The writer to use). (default: adams.data.io.output.CsvSpreadSheetWriter)
- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
Saver
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected File
m_OutputFile
the file to write to.protected adams.data.io.output.SpreadSheetWriter
m_Writer
the spreadsheet writer to use.-
Fields inherited from class weka.core.converters.AbstractFileSaver
m_env, m_incrementalCounter, m_useRelativePath
-
-
Constructor Summary
Constructors Constructor Description SpreadSheetSaver()
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description weka.core.Capabilities
getCapabilities()
Returns the Capabilities of this saver.String
getFileDescription()
Returns a description of the file type.String
getFileExtension()
Get the file extension used for this type of fileString[]
getFileExtensions()
Gets all the file extensions used for this type of fileString[]
getOptions()
returns the options of the current setupString
getRevision()
Returns the revision string.adams.data.io.output.SpreadSheetWriter
getSpreadSheetWriter()
Returns the spreadsheet writer in use.String
globalInfo()
Returns a string describing this SaverEnumeration
listOptions()
Returns an enumeration describing the available options.static void
main(String[] args)
Main method.void
resetOptions()
void
setDestination(File file)
Sets the destination file (and directories if necessary).void
setDestination(OutputStream output)
Default implementation throws an IOException.void
setOptions(String[] options)
Parses the options for this object.void
setSpreadSheetWriter(adams.data.io.output.SpreadSheetWriter value)
Sets the spreadsheet writer to use.String
spreadSheetWriterTipText()
Returns the tip text for this propertyvoid
writeBatch()
Writes a Batch of instances-
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
-
-
-
-
Field Detail
-
m_Writer
protected adams.data.io.output.SpreadSheetWriter m_Writer
the spreadsheet writer to use.
-
m_OutputFile
protected File m_OutputFile
the file to write to.
-
-
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:
listOptions
in interfaceweka.core.OptionHandler
- Overrides:
listOptions
in classweka.core.converters.AbstractFileSaver
- Returns:
- an enumeration of all the available options.
-
resetOptions
public void resetOptions()
- Overrides:
resetOptions
in classweka.core.converters.AbstractFileSaver
-
getOptions
public String[] getOptions()
returns the options of the current setup- Specified by:
getOptions
in interfaceweka.core.OptionHandler
- Overrides:
getOptions
in classweka.core.converters.AbstractFileSaver
- Returns:
- the current options
-
setOptions
public void setOptions(String[] options) throws Exception
Parses the options for this object.
Valid options are:
-i <the input file> The input file
-o <the output file> The output file
-writer <classname + options> The writer to use). (default: adams.data.io.output.CsvSpreadSheetWriter)
- Specified by:
setOptions
in interfaceweka.core.OptionHandler
- Overrides:
setOptions
in 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:
getFileDescription
in interfaceweka.core.converters.FileSourcedConverter
- Specified by:
getFileDescription
in 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:
getFileExtension
in interfaceweka.core.converters.FileSourcedConverter
- Specified by:
getFileExtension
in interfaceweka.core.converters.Saver
- Overrides:
getFileExtension
in 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:
getFileExtensions
in interfaceweka.core.converters.FileSourcedConverter
- Overrides:
getFileExtensions
in classweka.core.converters.AbstractFileSaver
- Returns:
- the file extensions
-
setSpreadSheetWriter
public void setSpreadSheetWriter(adams.data.io.output.SpreadSheetWriter value)
Sets the spreadsheet writer to use.- Parameters:
value
- the writer to use
-
getSpreadSheetWriter
public adams.data.io.output.SpreadSheetWriter getSpreadSheetWriter()
Returns the spreadsheet writer in use.- Returns:
- the writer in use
-
spreadSheetWriterTipText
public String spreadSheetWriterTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns the Capabilities of this saver.- Specified by:
getCapabilities
in interfaceweka.core.CapabilitiesHandler
- Overrides:
getCapabilities
in 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:
setDestination
in interfaceweka.core.converters.Saver
- Overrides:
setDestination
in 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:
setDestination
in interfaceweka.core.converters.Saver
- Overrides:
setDestination
in classweka.core.converters.AbstractFileSaver
- Parameters:
output
- the OutputStream- Throws:
IOException
- always
-
writeBatch
public void writeBatch() throws IOException
Writes a Batch of instances- Specified by:
writeBatch
in interfaceweka.core.converters.Saver
- Specified by:
writeBatch
in 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:
getRevision
in interfaceweka.core.RevisionHandler
- Returns:
- the revision
-
main
public static void main(String[] args)
Main method.- Parameters:
args
- should contain the options of a Saver.
-
-