adams.core.io
Class GnuplotSpreadSheetWriter

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.core.io.AbstractSpreadSheetWriter
              extended by adams.core.io.GnuplotSpreadSheetWriter
All Implemented Interfaces:
Debuggable, Destroyable, OptionHandler, SizeOfHandler, Serializable

public class GnuplotSpreadSheetWriter
extends AbstractSpreadSheetWriter

Outputs all numeric columns of a spreadsheet in Gnuplot format.

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
 
-missing <java.lang.String> (property: missingValue)
    The placeholder for missing values.
    default: -999
 
-columns <java.lang.String> (property: columns)
    The columns in the spreadsheet to output.
    default: first-last
 
-invert (property: invert)
    If set to true, then the matching sense is inverted.
 

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

Field Summary
static String COMMENT
          the line comment start.
protected  Range m_Columns
          the range of columns to output in the data file.
static String MISSING_VALUE
          the default for missing values.
 
Fields inherited from class adams.core.io.AbstractSpreadSheetWriter
m_MissingValue
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
GnuplotSpreadSheetWriter()
           
 
Method Summary
 String columnsTipText()
          Returns the tip text for this property.
 void defineOptions()
          Adds options to the internal list of options.
protected  boolean doWrite(SpreadSheet content, Writer writer)
          Performs the actual writing.
 Range getColumns()
          Returns the current placeholder for missing values.
protected  String getDefaultMissingValue()
          Returns the default missing value.
 String getFormatDescription()
          Returns a string describing the format (used in the file chooser).
 String[] getFormatExtensions()
          Returns the extension(s) of the format.
 boolean getInvert()
          Returns whether to invert the matching sense.
protected  boolean getUseOutputStream()
          Returns whether to write to an OutputStream rather than a Writer.
 String globalInfo()
          Returns a string describing the object.
protected  void initialize()
          Initializes the members.
 String invertTipText()
          Returns the tip text for this property.
 void setColumns(Range value)
          Sets the placeholder for missing values.
 void setInvert(boolean value)
          Sets whether to invert the matching sense.
 
Methods inherited from class adams.core.io.AbstractSpreadSheetWriter
doWrite, getMissingValue, getWriters, missingValueTipText, setMissingValue, write, write, write, write
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, destroy, finishInit, getDebugLevel, getOptionManager, isDebugOn, newOptionManager, reset, 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

COMMENT

public static final String COMMENT
the line comment start.

See Also:
Constant Field Values

MISSING_VALUE

public static final String MISSING_VALUE
the default for missing values.

See Also:
Constant Field Values

m_Columns

protected Range m_Columns
the range of columns to output in the data file.

Constructor Detail

GnuplotSpreadSheetWriter

public GnuplotSpreadSheetWriter()
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

initialize

protected void initialize()
Initializes the members.

Overrides:
initialize in class AbstractOptionHandler

defineOptions

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

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

getFormatDescription

public String getFormatDescription()
Returns a string describing the format (used in the file chooser).

Specified by:
getFormatDescription in class AbstractSpreadSheetWriter
Returns:
a description suitable for displaying in the file chooser

getFormatExtensions

public String[] getFormatExtensions()
Returns the extension(s) of the format.

Specified by:
getFormatExtensions in class AbstractSpreadSheetWriter
Returns:
the extension (without the dot!)

getDefaultMissingValue

protected String getDefaultMissingValue()
Returns the default missing value.

Overrides:
getDefaultMissingValue in class AbstractSpreadSheetWriter
Returns:
the default for missing values

setColumns

public void setColumns(Range value)
Sets the placeholder for missing values.

Parameters:
value - the placeholder

getColumns

public Range getColumns()
Returns the current placeholder for missing values.

Returns:
the placeholder

columnsTipText

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

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

setInvert

public void setInvert(boolean value)
Sets whether to invert the matching sense.

Parameters:
value - true if inverting matching sense

getInvert

public boolean getInvert()
Returns whether to invert the matching sense.

Returns:
true if matching sense is inverted

invertTipText

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

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

getUseOutputStream

protected boolean getUseOutputStream()
Returns whether to write to an OutputStream rather than a Writer.

Specified by:
getUseOutputStream in class AbstractSpreadSheetWriter
Returns:
true if to write to an OutputStream

doWrite

protected boolean doWrite(SpreadSheet content,
                          Writer writer)
Performs the actual writing. The caller must ensure that the writer gets closed.

Overrides:
doWrite in class AbstractSpreadSheetWriter
Parameters:
content - the spreadsheet to write
writer - the writer to write the spreadsheet to
Returns:
true if successfully written


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