adams.core.gnuplot
Class AbstractScriptlet

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.core.gnuplot.AbstractScriptlet
All Implemented Interfaces:
Debuggable, Destroyable, OptionHandler, SizeOfHandler, Serializable
Direct Known Subclasses:
AbstractPlotScriptlet, CustomScriptlet, Initialize, MultiScriptlet, Pause

public abstract class AbstractScriptlet
extends AbstractOptionHandler

Ancestor for scriplets that generate Gnuplot scripts (or parts of it).

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

Field Summary
static String COMMENT
          the character for comments in Gnuplot scripts.
protected  PlaceholderFile m_DataFile
          the data file to use.
protected  String m_LastError
          stores the error message if the check failed.
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
AbstractScriptlet()
           
 
Method Summary
 String check()
          Hook method for performing checks.
 String dataFileTipText()
          Returns the tip text for this property.
 void defineOptions()
          Adds options to the internal list of options.
protected abstract  String doGenerate()
          Generates the actual script code.
 String generate()
          Returns the generated script-code string.
 PlaceholderFile getDataFile()
          Returns the data file in use.
 String getLastError()
          Returns the error that occurred during the last generation.
 boolean hasLastError()
          Checks whether an error was encountered during the last generation.
protected  void reset()
          Resets the scriptlet.
 void setDataFile(PlaceholderFile value)
          Sets the data file to use.
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, destroy, finishInit, getDebugLevel, getOptionManager, globalInfo, initialize, isDebugOn, newOptionManager, 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 character for comments in Gnuplot scripts.

See Also:
Constant Field Values

m_DataFile

protected PlaceholderFile m_DataFile
the data file to use.


m_LastError

protected String m_LastError
stores the error message if the check failed.

Constructor Detail

AbstractScriptlet

public AbstractScriptlet()
Method Detail

defineOptions

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

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

reset

protected void reset()
Resets the scriptlet.

Overrides:
reset in class AbstractOptionHandler

setDataFile

public void setDataFile(PlaceholderFile value)
Sets the data file to use.

Parameters:
value - the data file

getDataFile

public PlaceholderFile getDataFile()
Returns the data file in use.

Returns:
the data file

dataFileTipText

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

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

hasLastError

public boolean hasLastError()
Checks whether an error was encountered during the last generation.

Returns:
true if an error was encountered

getLastError

public String getLastError()
Returns the error that occurred during the last generation.

Returns:
the error, null if none occurred

check

public String check()
Hook method for performing checks.

Default implementation only checks whether the data file is available.

Returns:
null if all checks passed, otherwise error message

doGenerate

protected abstract String doGenerate()
Generates the actual script code.

Returns:
the script code, null in case of an error

generate

public String generate()
Returns the generated script-code string.

Returns:
the script-code, null in case of an error


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