Class SpreadSheetRowBuffer

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, VariableChangeListener, Actor, ErrorHandler, InputConsumer, OutputProducer, VariableMonitor, Serializable, Comparable

    public class SpreadSheetRowBuffer
    extends AbstractTransformer
    implements VariableMonitor
    Can act in two different ways:
    1. Row -> SpreadSheet
    Buffers adams.data.spreadsheet.Row objects and outputs a adams.data.spreadsheet.SpreadSheet object, whenever the interval condition has been met.
    2. SpreadSheet -> Row
    Outputs all the adams.data.spreadsheet.Row objects that the incoming adams.data.spreadsheet.SpreadSheet object contains.

    Input/output:
    - accepts:
       adams.data.spreadsheet.Row
       adams.data.spreadsheet.Row[]
    - generates:
       adams.data.spreadsheet.SpreadSheet


    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: SpreadSheetRowBuffer
     
    -annotation <adams.core.base.BaseAnnotation> (property: annotations)
        The annotations to attach to this actor.
        default:
     
    -skip <boolean> (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded
        as it is.
        default: false
     
    -stop-flow-on-error <boolean> (property: stopFlowOnError)
        If set to true, the flow execution at this level gets stopped in case this
        actor encounters an error; the error gets propagated; useful for critical
        actors.
        default: false
     
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console; Note: the enclosing
        actor handler must have this enabled as well.
        default: false
     
    -operation <SPREADSHEET_TO_ROW|ROW_TO_SPREADSHEET> (property: operation)
        The way the buffer operates.
        default: ROW_TO_SPREADSHEET
     
    -check <boolean> (property: checkHeader)
        Whether to check the headers - if the headers change, the Row object gets
        added to a new spreadsheet (in case of ROW_TO_SPREADSHEET).
        default: false
     
    -interval <int> (property: interval)
        The interval at which to output the SpreadSheet object (in case of ROW_TO_SPREADSHEET
        ).
        default: 1
        minimum: 1
     
    -clear-buffer <boolean> (property: clearBuffer)
        Whether to clear the buffer once the dataset has been forwarded (in case
        of ROW_TO_SPREADSHEET).
        default: false
     
    -var-name <adams.core.VariableName> (property: variableName)
        The variable to monitor.
        default: variable
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • BACKUP_BUFFER

        public static final String BACKUP_BUFFER
        the key for storing the current buffer in the backup.
        See Also:
        Constant Field Values
      • BACKUP_ITERATOR

        public static final String BACKUP_ITERATOR
        the key for storing the current iterator in the backup.
        See Also:
        Constant Field Values
      • m_Buffer

        protected SpreadSheet m_Buffer
        the currently buffered data.
      • m_Iterator

        protected Iterator<DataRow> m_Iterator
        the iterator for broadcasting Row objects.
      • m_CheckHeader

        protected boolean m_CheckHeader
        whether to check the header.
      • m_Interval

        protected int m_Interval
        the interval of when to output the SpreadSheet object.
      • m_ClearBuffer

        protected boolean m_ClearBuffer
        whether to clear the buffer once it has been forwarded.
      • m_VariableName

        protected VariableName m_VariableName
        the variable to listen to.
      • m_ClearBufferRequired

        protected boolean m_ClearBufferRequired
        whether variable triggered clear of buffer.
    • Constructor Detail

      • SpreadSheetRowBuffer

        public SpreadSheetRowBuffer()
    • Method Detail

      • setOperation

        public void setOperation​(SpreadSheetRowBuffer.Operation value)
        Sets the way the buffer operates.
        Parameters:
        value - the operation
      • operationTipText

        public String operationTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setCheckHeader

        public void setCheckHeader​(boolean value)
        Sets whether to check the header or not.
        Parameters:
        value - if true then the headers get checked
      • getCheckHeader

        public boolean getCheckHeader()
        Returns whether the header gets checked or not.
        Returns:
        true if the header gets checked
      • checkHeaderTipText

        public String checkHeaderTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setInterval

        public void setInterval​(int value)
        Sets the interval for outputting the SpreadSheet objects.
        Parameters:
        value - the interval
      • getInterval

        public int getInterval()
        Returns the interval for outputting the SpreadSheet objects.
        Returns:
        the interval
      • intervalTipText

        public String intervalTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setClearBuffer

        public void setClearBuffer​(boolean value)
        Sets whether to clear the buffer once the dataset has been forwarded.
        Parameters:
        value - true if to clear buffer
      • getClearBuffer

        public boolean getClearBuffer()
        Returns whether to clear the buffer once the dataset has been forwarded.
        Returns:
        true if to clear buffer
      • clearBufferTipText

        public String clearBufferTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • variableNameTipText

        public String variableNameTipText()
        Returns the tip text for this property.
        Specified by:
        variableNameTipText in interface VariableMonitor
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Specified by:
        accepts in interface InputConsumer
        Returns:
        the type of accepted data
      • generates

        public Class[] generates()
        Returns the class of objects that it generates.
        Specified by:
        generates in interface OutputProducer
        Returns:
        the type of generated data
      • reset

        protected void reset()
        Resets the scheme.
        Overrides:
        reset in class AbstractActor
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message