Class AbstractRatInput

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected String m_LoggingPrefix
      the logging prefix.
      protected Rat m_Owner
      the owner.
      protected boolean m_ReceptionInterrupted
      whether reception was interrupted.
      protected boolean m_ReceptionRunning
      whether reception is currently underway.
      protected boolean m_Stopped
      whether the reception was stopped.
      • 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
      protected boolean canReceive()
      Whether reception is possible.
      protected String check()
      Hook method for performing checks before receiving data.
      void cleanUp()
      Cleans up data structures, frees up memory.
      protected void configureLogger()
      Initializes the logger.
      protected abstract String doReceive()
      Performs the actual reception of data.
      protected void doWait​(int msec)
      A simple waiting method.
      abstract Class generates()
      Returns the type of data this scheme generates.
      String getAdditionalInformation()
      Returns the additional information.
      String getFullName()
      Returns the full name of the receiver.
      Rat getOwner()
      Returns the actor the receiver belongs to.
      protected adams.flow.control.StorageQueueHandler getQueue​(adams.flow.control.StorageName name)
      Returns the flow's queue.
      String getQuickInfo()
      Returns a quick info about the actor, which will be displayed in the GUI.
      boolean getReceptionInterrupted()
      Returns whether the reception was interrupted.
      protected String handleException​(String msg, Throwable t)
      Outputs the stacktrace along with the message on stderr and returns a combination of both of them as string.
      abstract boolean hasPendingOutput()
      Checks whether any output can be collected.
      protected void initialize()
      Initializes the members.
      String initReception()
      Initializes the reception.
      void interruptReception()
      Interrupts the reception (eg when pausing).
      boolean isReceptionRunning()
      Returns whether the reception is currently running.
      boolean isStopped()
      Returns whether the receiver has been stopped.
      abstract Object output()
      Returns the received data.
      String receive()
      Initiates the reception of data.
      void setOwner​(Rat value)
      Sets the actor the receiver belongs to.
      String setUp()
      Hook method for performing checks at setup time.
      AbstractRatInput shallowCopy()
      Returns a shallow copy of itself, i.e., based on the commandline options.
      AbstractRatInput shallowCopy​(boolean expand)
      Returns a shallow copy of itself, i.e., based on the commandline options.
      void stopExecution()
      Stops the execution.
      protected void updatePrefix()
      Updates the prefix of the logger.
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.core.Destroyable

        destroy
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
      • Methods inherited from interface adams.core.option.OptionHandler

        cleanUpOptions, defineOptions, getOptionManager, toCommandLine
    • Field Detail

      • m_Owner

        protected Rat m_Owner
        the owner.
      • m_Stopped

        protected boolean m_Stopped
        whether the reception was stopped.
      • m_LoggingPrefix

        protected String m_LoggingPrefix
        the logging prefix.
      • m_ReceptionRunning

        protected boolean m_ReceptionRunning
        whether reception is currently underway.
      • m_ReceptionInterrupted

        protected boolean m_ReceptionInterrupted
        whether reception was interrupted.
    • Constructor Detail

      • AbstractRatInput

        public AbstractRatInput()
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class adams.core.option.AbstractOptionHandler
      • configureLogger

        protected void configureLogger()
        Initializes the logger.
        Overrides:
        configureLogger in class adams.core.logging.LoggingObject
      • getFullName

        public String getFullName()
        Returns the full name of the receiver.
        Specified by:
        getFullName in interface RatInput
        Returns:
        the name
      • updatePrefix

        protected void updatePrefix()
        Updates the prefix of the logger.
      • setOwner

        public void setOwner​(Rat value)
        Sets the actor the receiver belongs to.
        Specified by:
        setOwner in interface RatInput
        Parameters:
        value - the owner
      • getOwner

        public Rat getOwner()
        Returns the actor the receiver belongs to.
        Specified by:
        getOwner in interface RatInput
        Returns:
        the owner
      • handleException

        protected String handleException​(String msg,
                                         Throwable t)
        Outputs the stacktrace along with the message on stderr and returns a combination of both of them as string.
        Parameters:
        msg - the message for the exception
        t - the exception
        Returns:
        the full error message (message + stacktrace)
      • getAdditionalInformation

        public String getAdditionalInformation()
        Returns the additional information.
        Specified by:
        getAdditionalInformation in interface adams.core.AdditionalInformationHandler
        Returns:
        the additional information, null or 0-length string for no information
      • getQuickInfo

        public String getQuickInfo()
        Returns a quick info about the actor, which will 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
      • generates

        public abstract Class generates()
        Returns the type of data this scheme generates.
        Specified by:
        generates in interface RatInput
        Returns:
        the type of data
      • hasPendingOutput

        public abstract boolean hasPendingOutput()
        Checks whether any output can be collected.
        Specified by:
        hasPendingOutput in interface RatInput
        Returns:
        true if output available
      • output

        public abstract Object output()
        Returns the received data.
        Specified by:
        output in interface RatInput
        Returns:
        the data
      • setUp

        public String setUp()
        Hook method for performing checks at setup time.
        Specified by:
        setUp in interface RatInput
        Returns:
        null if successful, otherwise error message
      • check

        protected String check()
        Hook method for performing checks before receiving data.

        Default implementation returns null.
        Returns:
        null if successful, otherwise error message
      • doWait

        protected void doWait​(int msec)
        A simple waiting method.
        Parameters:
        msec - the maximum number of milli-seconds to wait, no waiting if 0
      • getQueue

        protected adams.flow.control.StorageQueueHandler getQueue​(adams.flow.control.StorageName name)
        Returns the flow's queue.
        Parameters:
        name - the name of the queue
        Returns:
        the queue, null if not initialized
        See Also:
        QueueInit
      • initReception

        public String initReception()
        Initializes the reception.
        Specified by:
        initReception in interface RatInput
        Returns:
        null if successfully initialized, otherwise error message
      • doReceive

        protected abstract String doReceive()
        Performs the actual reception of data.
        Returns:
        null if successful, otherwise error message
      • interruptReception

        public void interruptReception()
        Interrupts the reception (eg when pausing).
        Specified by:
        interruptReception in interface RatInput
      • getReceptionInterrupted

        public boolean getReceptionInterrupted()
        Returns whether the reception was interrupted.
        Specified by:
        getReceptionInterrupted in interface RatInput
        Returns:
        true if interrupted
      • isReceptionRunning

        public boolean isReceptionRunning()
        Returns whether the reception is currently running.
        Specified by:
        isReceptionRunning in interface RatInput
        Returns:
        true if running
      • receive

        public String receive()
        Initiates the reception of data.
        Specified by:
        receive in interface RatInput
        Returns:
        null if successful, otherwise error message
      • shallowCopy

        public AbstractRatInput shallowCopy()
        Returns a shallow copy of itself, i.e., based on the commandline options.
        Specified by:
        shallowCopy in interface adams.core.ShallowCopySupporter<AbstractRatInput>
        Returns:
        the shallow copy
      • shallowCopy

        public AbstractRatInput shallowCopy​(boolean expand)
        Returns a shallow copy of itself, i.e., based on the commandline options.
        Specified by:
        shallowCopy in interface adams.core.ShallowCopySupporter<AbstractRatInput>
        Parameters:
        expand - whether to expand variables to their current values
        Returns:
        the shallow copy
      • stopExecution

        public void stopExecution()
        Stops the execution.
        Specified by:
        stopExecution in interface RatInput
        Specified by:
        stopExecution in interface adams.core.Stoppable
      • isStopped

        public boolean isStopped()
        Returns whether the receiver has been stopped.
        Specified by:
        isStopped in interface RatInput
        Specified by:
        isStopped in interface adams.core.StoppableWithFeedback
        Returns:
        true if stopped
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.
        Specified by:
        cleanUp in interface adams.core.CleanUpHandler