adams.flow.sink
Class WekaFileWriter

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.flow.core.AbstractActor
              extended by adams.flow.sink.AbstractSink
                  extended by adams.flow.sink.AbstractFileWriter
                      extended by adams.flow.sink.WekaFileWriter
All Implemented Interfaces:
AdditionalInformationHandler, CleanUpHandler, Debuggable, DebugOutputHandler, Destroyable, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<AbstractActor>, SizeOfHandler, Stoppable, VariableChangeListener, ErrorHandler, InputConsumer, Serializable, Comparable

public class WekaFileWriter
extends AbstractFileWriter

Actor for saving a weka.core.Instances object as file.
The relation name of the incoming dataset can be used to replace the current filename (path and extension are kept).

Input/output:
- accepts:
   weka.core.Instances

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
 
-name <java.lang.String> (property: name)
    The name of the actor.
    default: WekaFileWriter
 
-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.
 
-output <adams.core.io.PlaceholderFile> (property: outputFile)
    The filename of the dataset to write (the file extension determines the
    file format).
    default: .
 
-use-relation (property: useRelationNameAsFilename)
    If set to true, then the relation name replaces the name of the output file;
     eg if the output file is '/some/where/file.arff' and the relation is 'anneal'
     then the resulting file name will be '/some/where/anneal.arff'.
 
-use-custom (property: useCustomSaver)
    If set to true, then the custom saver will be used for saving the data.
 
-saver <weka.core.converters.AbstractFileSaver [options]> (property: customSaver)
    The custom saver to use if enabled.
    default: weka.core.converters.ArffSaver
 

Version:
$Revision: 4584 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Field Summary
protected  weka.core.converters.AbstractFileSaver m_CustomSaver
          the custom saver.
protected  boolean m_UseCustomSaver
          whether to use a custom converter.
protected  boolean m_UseRelationNameAsFilename
          whether to use the relation name as filename.
 
Fields inherited from class adams.flow.sink.AbstractFileWriter
m_OutputFile
 
Fields inherited from class adams.flow.sink.AbstractSink
BACKUP_INPUT, m_InputToken
 
Fields inherited from class adams.flow.core.AbstractActor
FILE_EXTENSION, FILE_EXTENSION_GZ, m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_FullName, m_Headless, m_Name, m_Parent, m_Root, 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
 
Constructor Summary
WekaFileWriter()
           
 
Method Summary
 Class[] accepts()
          Returns the class that the consumer accepts.
 String customSaverTipText()
          Returns the tip text for this property.
 void defineOptions()
          Adds options to the internal list of options.
protected  String doExecute()
          Executes the flow item.
 weka.core.converters.AbstractFileSaver getCustomSaver()
          Returns the custom saver in use.
 boolean getUseCustomSaver()
          Returns whether a custom saver is used or not.
 boolean getUseRelationNameAsFilename()
          Returns whether the relation name is used as filename.
 String globalInfo()
          Returns a string describing the object.
 String outputFileTipText()
          Returns the tip text for this property.
protected  String performSetUpChecks(boolean fromSetUp)
          Hook for performing setup checks -- used in setUp() and preExecute().
 void setCustomSaver(weka.core.converters.AbstractFileSaver value)
          Sets the custom saver to use.
 void setUseCustomSaver(boolean value)
          Sets whether to use a custom saver or not.
 void setUseRelationNameAsFilename(boolean value)
          Sets whether to use the relation name as filename instead.
 String useCustomSaverTipText()
          Returns the tip text for this property.
 String useRelationNameAsFilenameTipText()
          Returns the tip text for this property.
 
Methods inherited from class adams.flow.sink.AbstractFileWriter
getDefaultOutputFile, getOutputFile, getQuickInfo, setOutputFile, setUp
 
Methods inherited from class adams.flow.sink.AbstractSink
backupState, input, restoreState, wrapUp
 
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, debug, destroy, equals, execute, findVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFullName, getName, getNextSibling, getParent, getPreviousSibling, getRoot, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isFinished, isHeadless, isStopped, nameTipText, postExecute, preExecute, pruneBackup, pruneBackup, reset, setAnnotations, setErrorHandler, setHeadless, setName, setParent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, sizeOf, skipTipText, stopExecution, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
 
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
 

Field Detail

m_UseRelationNameAsFilename

protected boolean m_UseRelationNameAsFilename
whether to use the relation name as filename.


m_UseCustomSaver

protected boolean m_UseCustomSaver
whether to use a custom converter.


m_CustomSaver

protected weka.core.converters.AbstractFileSaver m_CustomSaver
the custom saver.

Constructor Detail

WekaFileWriter

public WekaFileWriter()
Method Detail

globalInfo

public String globalInfo()
Returns a string describing the object.

Specified by:
globalInfo in class AbstractOptionHandler
Returns:
a description suitable for displaying in the gui

defineOptions

public void defineOptions()
Adds options to the internal list of options.

Specified by:
defineOptions in interface OptionHandler
Overrides:
defineOptions in class AbstractFileWriter

outputFileTipText

public String outputFileTipText()
Returns the tip text for this property.

Specified by:
outputFileTipText in class AbstractFileWriter
Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setUseRelationNameAsFilename

public void setUseRelationNameAsFilename(boolean value)
Sets whether to use the relation name as filename instead.

Parameters:
value - if true then the relation name will be used

getUseRelationNameAsFilename

public boolean getUseRelationNameAsFilename()
Returns whether the relation name is used as filename.

Returns:
true if the relation name is used

useRelationNameAsFilenameTipText

public String useRelationNameAsFilenameTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setUseCustomSaver

public void setUseCustomSaver(boolean value)
Sets whether to use a custom saver or not.

Parameters:
value - if true then the custom saver will be used

getUseCustomSaver

public boolean getUseCustomSaver()
Returns whether a custom saver is used or not.

Returns:
true if a custom saver is used

useCustomSaverTipText

public String useCustomSaverTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setCustomSaver

public void setCustomSaver(weka.core.converters.AbstractFileSaver value)
Sets the custom saver to use.

Parameters:
value - the custom saver

getCustomSaver

public weka.core.converters.AbstractFileSaver getCustomSaver()
Returns the custom saver in use.

Returns:
the custom saver

customSaverTipText

public String customSaverTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

accepts

public Class[] accepts()
Returns the class that the consumer accepts.

Returns:
weka.core.Instances.class

performSetUpChecks

protected String performSetUpChecks(boolean fromSetUp)
Hook for performing setup checks -- used in setUp() and preExecute().

Overrides:
performSetUpChecks in class AbstractActor
Parameters:
fromSetUp - whether the method has been called from within setUp()
Returns:
null if everything OK, otherwise error message

doExecute

protected String doExecute()
Executes the flow item.

Specified by:
doExecute in class AbstractActor
Returns:
null if everything is fine, otherwise error message


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.