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.QuickInfoSupporterAncestor 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 StringCOMMENTthe character for comments in Gnuplot scripts.protected Stringm_LastErrorstores the error message if the check failed.protected adams.flow.core.Actorm_Ownerthe owning actor.
-
Constructor Summary
Constructors Constructor Description AbstractScriptlet()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Stringcheck()Hook method for performing checks.protected abstract StringdoGenerate()Generates the actual script code.Stringgenerate()Returns the generated script-code string.StringgetLastError()Returns the error that occurred during the last generation.adams.flow.core.ActorgetOwner()Returns the owning actor.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.booleanhasLastError()Checks whether an error was encountered during the last generation.protected voidreset()Resets the scriptlet.voidsetOwner(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:
resetin 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:
hasLastErrorin 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:
getLastErrorin 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:
getQuickInfoin 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
-
-