Package adams.core.gnuplot
Class AbstractScriptlet
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.core.gnuplot.AbstractScriptlet
-
- All Implemented Interfaces:
adams.core.Destroyable
,adams.core.ErrorProvider
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.QuickInfoSupporter
,adams.core.SizeOfHandler
,Serializable
- Direct Known Subclasses:
AbstractScriptletWithDataFile
,CustomScriptlet
,Initialize
,Pause
public abstract class AbstractScriptlet extends adams.core.option.AbstractOptionHandler implements adams.core.ErrorProvider, adams.core.QuickInfoSupporter
Ancestor for scriplets that generate Gnuplot scripts (or parts of it).- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
COMMENT
the character for comments in Gnuplot scripts.protected String
m_LastError
stores the error message if the check failed.protected adams.flow.core.Actor
m_Owner
the owning actor.
-
Constructor Summary
Constructors Constructor Description AbstractScriptlet()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
check()
Hook method for performing checks.protected abstract String
doGenerate()
Generates the actual script code.String
generate()
Returns the generated script-code string.String
getLastError()
Returns the error that occurred during the last generation.adams.flow.core.Actor
getOwner()
Returns the owning actor.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.boolean
hasLastError()
Checks whether an error was encountered during the last generation.protected void
reset()
Resets the scriptlet.void
setOwner(adams.flow.core.Actor value)
Sets the owning actor.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_Owner
protected adams.flow.core.Actor m_Owner
the owning actor.
-
COMMENT
public static final String COMMENT
the character for comments in Gnuplot scripts.- See Also:
- Constant Field Values
-
m_LastError
protected String m_LastError
stores the error message if the check failed.
-
-
Method Detail
-
reset
protected void reset()
Resets the scriptlet.- Overrides:
reset
in classadams.core.option.AbstractOptionHandler
-
setOwner
public void setOwner(adams.flow.core.Actor value)
Sets the owning actor.- Parameters:
value
- the owner
-
getOwner
public adams.flow.core.Actor getOwner()
Returns the owning actor.- Returns:
- the owner
-
hasLastError
public boolean hasLastError()
Checks whether an error was encountered during the last generation.- Specified by:
hasLastError
in interfaceadams.core.ErrorProvider
- Returns:
- true if an error was encountered
-
getLastError
public String getLastError()
Returns the error that occurred during the last generation.- Specified by:
getLastError
in interfaceadams.core.ErrorProvider
- Returns:
- the error, null if none occurred
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.
Default implementation returns null.- Specified by:
getQuickInfo
in interfaceadams.core.QuickInfoSupporter
- Returns:
- null if no info available, otherwise short string
-
check
public String check()
Hook method for performing checks.
Default implementation does nothing, only warns if not owner set.- 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
-
-