Class ReportFieldFromStringValueWithLookup

  • All Implemented Interfaces:
    adams.core.CleanUpHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.ShallowCopySupporter<adams.data.filter.Filter>, adams.core.SizeOfHandler, adams.data.filter.Filter<Spectrum>, Serializable, Comparable

    public class ReportFieldFromStringValueWithLookup
    extends adams.data.filter.AbstractFilter<Spectrum>
    Extracts the first group from the regular expression matched against the report field value and uses this value as key in the provided lookup table generated from the specified key-value pairs.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class adams.data.filter.AbstractFilter

        adams.data.filter.AbstractFilter.FilterJob<T extends adams.data.container.DataContainer>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected adams.core.base.BaseRegExp m_Extract
      the regexp to extract the lookup key (uses 1st group).
      protected adams.core.base.BaseKeyValuePair[] m_Lookup
      the key-value pairs.
      protected adams.data.report.Field m_Source
      the report field to read from.
      protected Map<String,​String> m_Table
      the lookup table.
      protected adams.data.report.Field m_Target
      the report field to store the result in.
      • Fields inherited from class adams.data.filter.AbstractFilter

        m_DontUpdateID
      • 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 Concrete Methods 
      Modifier and Type Method Description
      void defineOptions()
      Adds options to the internal list of options.
      String extractTipText()
      Returns the tip text for this property.
      adams.core.base.BaseRegExp getExtract()
      Returns the regexp for extracting the substring to use in the lookup.
      adams.core.base.BaseKeyValuePair[] getLookup()
      Returns the key-value pairs that make up the lookup table.
      adams.data.report.Field getSource()
      Returns the source field to use.
      adams.data.report.Field getTarget()
      Returns the target field to use for the result.
      String globalInfo()
      Returns a string describing the object.
      String lookupTipText()
      Returns the tip text for this property.
      protected Spectrum processData​(Spectrum data)
      Performs the actual filtering.
      void reset()
      Resets the scheme.
      void setExtract​(adams.core.base.BaseRegExp value)
      Sets the regexp for extracting the substring to use in the lookup.
      void setLookup​(adams.core.base.BaseKeyValuePair[] value)
      Sets the key-value pairs that make up the lookup table.
      void setSource​(adams.data.report.Field value)
      Sets the source field to use.
      void setTarget​(adams.data.report.Field value)
      Sets the target field to use for the result.
      String sourceTipText()
      Returns the tip text for this property.
      String targetTipText()
      Returns the tip text for this property.
      • Methods inherited from class adams.data.filter.AbstractFilter

        checkData, cleanUp, compareTo, destroy, dontUpdateIDTipText, equals, filter, forCommandLine, getDontUpdateID, setDontUpdateID, shallowCopy, shallowCopy
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, 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, setLoggingLevel
      • Methods inherited from interface adams.core.logging.LoggingSupporter

        getLogger, isLoggingEnabled
      • Methods inherited from interface adams.core.option.OptionHandler

        cleanUpOptions, getOptionManager, toCommandLine
    • Field Detail

      • m_Source

        protected adams.data.report.Field m_Source
        the report field to read from.
      • m_Extract

        protected adams.core.base.BaseRegExp m_Extract
        the regexp to extract the lookup key (uses 1st group).
      • m_Lookup

        protected adams.core.base.BaseKeyValuePair[] m_Lookup
        the key-value pairs.
      • m_Target

        protected adams.data.report.Field m_Target
        the report field to store the result in.
      • m_Table

        protected transient Map<String,​String> m_Table
        the lookup table.
    • Constructor Detail

      • ReportFieldFromStringValueWithLookup

        public ReportFieldFromStringValueWithLookup()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.data.filter.AbstractFilter<Spectrum>
      • reset

        public void reset()
        Resets the scheme.
        Specified by:
        reset in interface adams.data.filter.Filter<Spectrum>
        Overrides:
        reset in class adams.data.filter.AbstractFilter<Spectrum>
      • setSource

        public void setSource​(adams.data.report.Field value)
        Sets the source field to use.
        Parameters:
        value - the field
      • getSource

        public adams.data.report.Field getSource()
        Returns the source field to use.
        Returns:
        the field
      • sourceTipText

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

        public void setExtract​(adams.core.base.BaseRegExp value)
        Sets the regexp for extracting the substring to use in the lookup.
        Parameters:
        value - the expression
      • getExtract

        public adams.core.base.BaseRegExp getExtract()
        Returns the regexp for extracting the substring to use in the lookup.
        Returns:
        the expression
      • extractTipText

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

        public void setLookup​(adams.core.base.BaseKeyValuePair[] value)
        Sets the key-value pairs that make up the lookup table.
        Parameters:
        value - the pairs
      • getLookup

        public adams.core.base.BaseKeyValuePair[] getLookup()
        Returns the key-value pairs that make up the lookup table.
        Returns:
        the pairs
      • lookupTipText

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

        public void setTarget​(adams.data.report.Field value)
        Sets the target field to use for the result.
        Parameters:
        value - the field
      • getTarget

        public adams.data.report.Field getTarget()
        Returns the target field to use for the result.
        Returns:
        the field
      • targetTipText

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

        protected Spectrum processData​(Spectrum data)
        Performs the actual filtering.
        Specified by:
        processData in class adams.data.filter.AbstractFilter<Spectrum>
        Parameters:
        data - the data to filter
        Returns:
        the filtered data