Class GroupExpression

  • All Implemented Interfaces:
    adams.core.GlobalInfoSupporter, Serializable, weka.core.OptionHandler

    public class GroupExpression
    extends AbstractRowSelection
    Identifies groups in strings using regular expressions. If the group attribute is numeric, then the values get turned into strings first.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • INDEX

        protected static String INDEX
      • REGEXP

        protected static String REGEXP
      • m_RegExp

        protected adams.core.base.BaseRegExp m_RegExp
        the regular expression for the nominal/string attribute.
      • GROUP

        protected static String GROUP
      • m_Group

        protected String m_Group
        the group expression.
    • Constructor Detail

      • GroupExpression

        public GroupExpression()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the row selection scheme.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class AbstractMultiRowProcessorPlugin
        Returns:
        a description suitable for displaying in the explorer/experimenter gui
      • listOptions

        public Enumeration listOptions()
        Returns an enumeration describing the available options.
        Specified by:
        listOptions in interface weka.core.OptionHandler
        Overrides:
        listOptions in class AbstractMultiRowProcessorPlugin
        Returns:
        an enumeration of all the available options.
      • setOptions

        public void setOptions​(String[] options)
                        throws Exception
        Parses a given list of options.
        Specified by:
        setOptions in interface weka.core.OptionHandler
        Overrides:
        setOptions in class AbstractMultiRowProcessorPlugin
        Parameters:
        options - the list of options as an array of strings
        Throws:
        Exception - if an option is not supported
      • getOptions

        public String[] getOptions()
        Gets the current settings of the classifier.
        Specified by:
        getOptions in interface weka.core.OptionHandler
        Overrides:
        getOptions in class AbstractMultiRowProcessorPlugin
        Returns:
        an array of strings suitable for passing to setOptions
      • getDefaultIndex

        protected WekaAttributeIndex getDefaultIndex()
        Returns the default index.
        Returns:
        the default index
      • setIndex

        public void setIndex​(WekaAttributeIndex value)
        Sets the attribute index to use for grouping.
        Parameters:
        value - the index
      • getIndex

        public WekaAttributeIndex getIndex()
        Returns the attribute index to use for grouping.
        Returns:
        the index
      • indexTipText

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

        protected adams.core.base.BaseRegExp getDefaultRegExp()
        Returns the default regular expression.
        Returns:
        the default
      • setRegExp

        public void setRegExp​(adams.core.base.BaseRegExp value)
        Sets the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').
        Parameters:
        value - the expression
      • getRegExp

        public adams.core.base.BaseRegExp getRegExp()
        Returns the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').
        Returns:
        the expression
      • regExpTipText

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

        public void setGroup​(String value)
        Sets the replacement string to use as group (eg '$2').
        Parameters:
        value - the group
      • getGroup

        public String getGroup()
        Returns the replacement string to use as group (eg '$2').
        Returns:
        the group
      • groupTipText

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

        protected List<int[]> doSelectRows​(weka.core.Instances data)
                                    throws Exception
        Returns the list of row indices generated from the data.
        Specified by:
        doSelectRows in class AbstractRowSelection
        Parameters:
        data - the data to generate row selections from
        Returns:
        the list of selections
        Throws:
        Exception - if checks or selection failed