weka.gui.beans

## Class SubstringReplacerRules

- java.lang.Object
- - weka.gui.beans.SubstringReplacerRules

- All Implemented Interfaces:
    EnvironmentHandler

      public class SubstringReplacerRules
      extends java.lang.Object
      implements EnvironmentHandler

  Manages a list of match and replace rules for replacing values in string attributes
  Version:
    $Revision: 10383 $
  Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SubstringReplacerRules.SubstringReplacerMatchRule` Inner class encapsulating the logic for matching and replacing.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SubstringReplacerRules(java.lang.String matchDetails, Instances inputStructure)` Constructor.
    `SubstringReplacerRules(java.lang.String matchDetails, Instances inputStructure, java.lang.String statusMessagePrefix, Logger log, Environment env)` Constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `applyRules(Instance inst)`
    `static java.util.List<SubstringReplacerRules.SubstringReplacerMatchRule>` | `matchRulesFromInternal(java.lang.String matchReplaceDetails, Instances inputStructure, java.lang.String statusMessagePrefix, Logger log, Environment env)` Get a list of match rules from an internally encoded match specification
    `void` | `setEnvironment(Environment env)` Set environment variables to use.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SubstringReplacerRules

          public SubstringReplacerRules(java.lang.String matchDetails,
                                Instances inputStructure,
                                java.lang.String statusMessagePrefix,
                                Logger log,
                                Environment env)

      Constructor
      Parameters:
        `matchDetails` - the internally encoded match details string
        `inputStructure` - the incoming instances structure
        `statusMessagePrefix` - an optional status message prefix string for logging
        `log` - the log to use (may be null)
        `env` - environment variables

    - #### SubstringReplacerRules

          public SubstringReplacerRules(java.lang.String matchDetails,
                                Instances inputStructure)

      Constructor. Initializes with system-wide environment variables and uses no status message and no log.
      Parameters:
        `matchDetails` - the internally encoded match details string
        `inputStructure` - the incoming instances structure

  - ### Method Detail

    - #### setEnvironment

          public void setEnvironment(Environment env)

      Description copied from interface: `EnvironmentHandler`
      Set environment variables to use.
      Specified by:
        `setEnvironment` in interface `EnvironmentHandler`
      Parameters:
        `env` - the environment variables to use

    - #### matchRulesFromInternal

          public static java.util.List<SubstringReplacerRules.SubstringReplacerMatchRule> matchRulesFromInternal(java.lang.String matchReplaceDetails,
                                                                                                 Instances inputStructure,
                                                                                                 java.lang.String statusMessagePrefix,
                                                                                                 Logger log,
                                                                                                 Environment env)

      Get a list of match rules from an internally encoded match specification
      Parameters:
        `matchReplaceDetails` - the internally encoded specification of the match rules
        `inputStructure` - the input instances structure
        `statusMessagePrefix` - an optional status message prefix for logging
        `log` - the log to use
        `env` - environment variables
      Returns:
        a list of match rules

    - #### applyRules

          public void applyRules(Instance inst)