Package weka.gui.beans

# Class SubstringReplacerRules

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

All Implemented Interfaces:
  `Serializable`, `EnvironmentHandler`

public class SubstringReplacerRules extends Object implements EnvironmentHandler, Serializable
Manages a list of match and replace rules for replacing values in string attributes

Version:
  $Revision: 11968 $
Author:
  Mark Hall (mhall{[at]}pentaho{[dot]}com)
See Also:
  - Serialized Form

- ## Nested Class Summary

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

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `applyRules(Instance inst)`
  `Instance`
  `makeOutputInstance(Instance inputI)`
  Make an output instance given an input one
  `static List<SubstringReplacerRules.SubstringReplacerMatchRule>`
  `matchRulesFromInternal(String matchReplaceDetails, Instances inputStructure, 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 Details

  - ### SubstringReplacerRules

    public SubstringReplacerRules(String matchDetails, Instances inputStructure, 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(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 Details

  - ### 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 List<SubstringReplacerRules.SubstringReplacerMatchRule> matchRulesFromInternal(String matchReplaceDetails, Instances inputStructure, 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)

  - ### makeOutputInstance

    public Instance makeOutputInstance(Instance inputI)
    Make an output instance given an input one
    Parameters:
      `inputI` - the input instance to process
    Returns:
      the output instance with substrings replaced