Class NotesWriter

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

    public class NotesWriter
    extends AbstractSink
    Saves the notes attached to a data structure to a text file.

    Input/output:
    - accepts:
       adams.data.NotesHandler


    Valid options are:

    -D <int> (property: debugLevel)
        The greater the number the more additional info the scheme may output to
        the console (0 = off).
        default: 0
        minimum: 0
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: NotesWriter
     
    -annotation <adams.core.base.BaseText> (property: annotations)
        The annotations to attach to this actor.
        default:
     
    -skip (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded
        as it is.
     
    -outputDir <adams.core.io.PlaceholderFile> (property: outputDir)
        The output directory for the notes.
        default: .
     
    -suffix <java.lang.String> (property: suffix)
        The suffix for the notes filename, before the extension.
        default:
     
    -generator <adams.data.id.AbstractIDGenerator [options]> (property: generator)
        The generator to use for generating the IDs.
        default: adams.data.id.SimpleIDGenerator
     
    -output-db-id (property: outputDatabaseID)
        If set to true, then the database ID will be output in the file as well.
     
    -output-errors (property: outputErrors)
        If set to true, then the errors will be output.
     
    -output-warnings (property: outputWarnings)
        If set to true, then the warnings will be output.
     
    -output-process-info (property: outputProcessInformation)
        If set to true, then the process information will be output.
     
    -output-all (property: outputAll)
        If set to true, then everything will be output.
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Suffix

        protected String m_Suffix
        the suffix for the filename (before the ".txt" extension).
      • m_OutputDatabaseID

        protected boolean m_OutputDatabaseID
        whether to include the database ID as well in the text file.
      • m_OutputErrors

        protected boolean m_OutputErrors
        whether to output the errors.
      • m_OutputWarnings

        protected boolean m_OutputWarnings
        whether to output the warnings.
      • m_OutputProcessInformation

        protected boolean m_OutputProcessInformation
        whether to output the process information.
      • m_OutputAll

        protected boolean m_OutputAll
        whether to output everything.
    • Constructor Detail

      • NotesWriter

        public NotesWriter()
    • Method Detail

      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Returns:
        adams.data.NotesHandler.class
      • setOutputDir

        public void setOutputDir​(PlaceholderDirectory value)
        Sets the output directory.
        Parameters:
        value - the output directory
      • getOutputDir

        public PlaceholderDirectory getOutputDir()
        Returns the output directory.
        Returns:
        the output directory
      • outputDirTipText

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

        public void setGenerator​(AbstractIDGenerator value)
        Sets the generator to use.
        Parameters:
        value - the generator
      • getGenerator

        public AbstractIDGenerator getGenerator()
        Returns the generator in use.
        Returns:
        the generator
      • generatorTipText

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

        public void setSuffix​(String value)
        Sets the suffix for the notes.
        Parameters:
        value - the suffix
      • getSuffix

        public String getSuffix()
        Returns the suffix for the notes.
        Returns:
        the suffix
      • suffixTipText

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

        public void setOutputDatabaseID​(boolean value)
        Sets whether to output the database ID as well in the file.
        Parameters:
        value - if true then the database ID will be output
      • getOutputDatabaseID

        public boolean getOutputDatabaseID()
        Returns whether to output the database ID as well in the file.
        Returns:
        true if the database ID is output as well
      • outputDatabaseIDTipText

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

        public void setOutputErrors​(boolean value)
        Sets whether to output the errors.
        Parameters:
        value - if true then the errors will be output
      • getOutputErrors

        public boolean getOutputErrors()
        Returns whether to output the errors.
        Returns:
        true if the errors will be output
      • outputErrorsTipText

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

        public void setOutputWarnings​(boolean value)
        Sets whether to output the warnings.
        Parameters:
        value - if true then the warnings will be output
      • getOutputWarnings

        public boolean getOutputWarnings()
        Returns whether to output the warnings.
        Returns:
        true if the warnings will be output
      • outputWarningsTipText

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

        public void setOutputProcessInformation​(boolean value)
        Sets whether to output the process information.
        Parameters:
        value - if true then the process information will be output
      • getOutputProcessInformation

        public boolean getOutputProcessInformation()
        Returns whether to output the process information.
        Returns:
        true if the process information will be output
      • outputProcessInformationTipText

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

        public void setOutputAll​(boolean value)
        Sets whether to output everything.
        Parameters:
        value - if true then everything will be output
      • getOutputAll

        public boolean getOutputAll()
        Returns whether to output everything.
        Returns:
        true if everything will be output
      • outputAllTipText

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

        protected String[] notesToArray​(Notes notes)
        Turns the provided notes into an array, if th notes contain anything.
        Parameters:
        notes - the notes to convert
        Returns:
        the generated array of null if no notes present
      • merge

        protected String[] merge​(String[] array1,
                                 String[] array2)
        Generates an array combining both arrays.
        Parameters:
        array1 - the first array
        array2 - the second array
        Returns:
        the merged array
      • doExecute

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