Class GroupByRegExp

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

    public class GroupByRegExp
    extends AbstractArrayProvider
    Groups the incoming strings into sub-groups. For that purpose, the regular expression is applied and specified grouping expression is used as key for each group.

    Input/output:
    - accepts:
       java.lang.String[]
    - generates:
       java.lang.String[]


    -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: GroupByRegExp
     
    -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
     
    -output-array <boolean> (property: outputArray)
        If enabled, the groups are output as array instead of one-by-one.
        default: false
     
    -find <adams.core.base.BaseRegExp> (property: find)
        The string to find (a regular expression).
        default: (.*)
     
    -grouping <java.lang.String> (property: grouping)
        The expression to generate the grouping string from; can contain regexp
        groups like $0..$n.
        default: $1
     
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Find

        protected BaseRegExp m_Find
        the regular expression.
      • m_Grouping

        protected String m_Grouping
        the grouping.
    • Constructor Detail

      • GroupByRegExp

        public GroupByRegExp()
    • Method Detail

      • setFind

        public void setFind​(BaseRegExp value)
        Sets the string to find (regular expression).
        Parameters:
        value - the string
      • getFind

        public BaseRegExp getFind()
        Returns the string to find (regular expression).
        Returns:
        the string
      • findTipText

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

        public void setGrouping​(String value)
        Sets the string to generate the grouping string from, can contain regexp groups like $0..$n.
        Parameters:
        value - the string
      • getGrouping

        public String getGrouping()
        Returns the string to generate the grouping string from, can contain regexp groups like $0..$n..
        Returns:
        the string
      • groupingTipText

        public String groupingTipText()
        Returns the tip text for this property.
        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.
        Returns:
        the Class of objects that can be processed
      • doExecute

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