Class 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.
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • 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
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
    • Field Detail

      • m_Owner

        protected adams.flow.core.Actor m_Owner
        the owning actor.
      • m_LastError

        protected String m_LastError
        stores the error message if the check failed.
    • Constructor Detail

      • AbstractScriptlet

        public AbstractScriptlet()
    • Method Detail

      • reset

        protected void reset()
        Resets the scriptlet.
        Overrides:
        reset in class adams.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 interface adams.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 interface adams.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 interface adams.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