weka.knowledgeflow.steps

## Class FlowByExpression

- java.lang.Object
- - weka.knowledgeflow.steps.BaseStep
  - - weka.knowledgeflow.steps.FlowByExpression

- All Implemented Interfaces:
    java.io.Serializable, BaseStepExtender, Step

      @KFStep(name="FlowByExpression",
              category="Flow",
              toolTipText="Route instances according to the evaluation of a logical expression. The expression can test the values of one or more incoming attributes. The test can involve constants or comparing one attribute\'s values to another. Inequalities along with string operations such as contains, starts-with, ends-with and regular expressions may be used as operators. \"True\" instances can be sent to one downstream step and \"False\" instances sent to another.",
              iconPath="weka/gui/knowledgeflow/icons/FlowByExpression.png")
      public class FlowByExpression
      extends BaseStep

  A step that splits incoming instances (or instance streams) according to the evaluation of a logical expression. The expression can test the values of one or more incoming attributes. The test can involve constants or comparing one attribute's values to another. Inequalities along with string operations such as contains, starts-with, ends-with and regular expressions may be used as operators.
  Version:
    $Revision: $
  Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `FlowByExpression.BracketNode` An expression node that encloses other expression nodes in brackets
    `static class` | `FlowByExpression.ExpressionClause` An expression node that represents a clause of an expression
    `static class` | `FlowByExpression.ExpressionNode` Abstract base class for parts of a boolean expression.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FlowByExpression()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getCustomEditorForStep()` Return the fully qualified name of a custom editor component (JComponent) to use for editing the properties of the step.
    `java.util.List<java.lang.String>` | `getDownstreamStepNames()` Get a list of the names of connected downstream steps
    `java.lang.String` | `getExpressionString()` Get the current expression (in internal format)
    `java.lang.String` | `getFalseStepName()` Get the name of the connected step to send "false" instances to
    `java.util.List<java.lang.String>` | `getIncomingConnectionTypes()` Get a list of incoming connection types that this step can accept.
    `java.util.List<java.lang.String>` | `getOutgoingConnectionTypes()` Get a list of outgoing connection types that this step can produce.
    `java.lang.String` | `getTrueStepName()` Get the name of the connected step to send "true" instances to
    `Instances` | `outputStructureForConnectionType(java.lang.String connectionName)` If possible, get the output structure for the named connection type as a header-only set of instances.
    `void` | `processIncoming(Data data)` Main processing routine
    `void` | `setExpressionString(java.lang.String expressionString)` Set the expression (in internal format)
    `void` | `setFalseStepName(java.lang.String falseStep)` Set the name of the connected step to send "false" instances to
    `void` | `setTrueStepName(java.lang.String trueStep)` Set the name of the connected step to send "true" instances to
    `void` | `stepInit()` Initialize the step.

    - ### Methods inherited from class weka.knowledgeflow.steps.BaseStep

      `environmentSubstitute, getDefaultSettings, getInteractiveViewers, getInteractiveViewersImpls, getName, getStepManager, globalInfo, isResourceIntensive, isStopRequested, setName, setStepIsResourceIntensive, setStepManager, setStepMustRunSingleThreaded, start, stepMustRunSingleThreaded, stop`

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

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

- - ### Constructor Detail

    - #### FlowByExpression

          public FlowByExpression()

  - ### Method Detail

    - #### setExpressionString

          public void setExpressionString(java.lang.String expressionString)

      Set the expression (in internal format)
      Parameters:
        `expressionString` - the expression to use (in internal format)

    - #### getExpressionString

          public java.lang.String getExpressionString()

      Get the current expression (in internal format)
      Returns:
        the current expression (in internal format)

    - #### setTrueStepName

          public void setTrueStepName(java.lang.String trueStep)

      Set the name of the connected step to send "true" instances to
      Parameters:
        `trueStep` - the name of the step to send "true" instances to

    - #### getTrueStepName

          public java.lang.String getTrueStepName()

      Get the name of the connected step to send "true" instances to
      Returns:
        the name of the step to send "true" instances to

    - #### setFalseStepName

          public void setFalseStepName(java.lang.String falseStep)

      Set the name of the connected step to send "false" instances to
      Parameters:
        `falseStep` - the name of the step to send "false" instances to

    - #### getFalseStepName

          public java.lang.String getFalseStepName()

      Get the name of the connected step to send "false" instances to
      Returns:
        the name of the step to send "false" instances to

    - #### getDownstreamStepNames

          public java.util.List<java.lang.String> getDownstreamStepNames()

      Get a list of the names of connected downstream steps
      Returns:
        a list of the names of connected downstream steps

    - #### stepInit

          public void stepInit()
                        throws WekaException

      Initialize the step.
      Throws:
        `WekaException` - if a problem occurs during initialization

    - #### getIncomingConnectionTypes

          public java.util.List<java.lang.String> getIncomingConnectionTypes()

      Get a list of incoming connection types that this step can accept. Ideally (and if appropriate), this should take into account the state of the step and any existing incoming connections. E.g. a step might be able to accept one (and only one) incoming batch data connection.
      Returns:
        a list of incoming connections that this step can accept given its current state

    - #### getOutgoingConnectionTypes

          public java.util.List<java.lang.String> getOutgoingConnectionTypes()

      Get a list of outgoing connection types that this step can produce. Ideally (and if appropriate), this should take into account the state of the step and the incoming connections. E.g. depending on what incoming connection is present, a step might be able to produce a trainingSet output, a testSet output or neither, but not both.
      Returns:
        a list of outgoing connections that this step can produce

    - #### outputStructureForConnectionType

          public Instances outputStructureForConnectionType(java.lang.String connectionName)
                                                     throws WekaException

      If possible, get the output structure for the named connection type as a header-only set of instances. Can return null if the specified connection type is not representable as Instances or cannot be determined at present.
      Specified by:
        `outputStructureForConnectionType` in interface `Step`
      Overrides:
        `outputStructureForConnectionType` in class `BaseStep`
      Parameters:
        `connectionName` - the name of the connection type to get the output structure for
      Returns:
        the output structure as a header-only Instances object
      Throws:
        `WekaException` - if a problem occurs

    - #### processIncoming

          public void processIncoming(Data data)
                               throws WekaException

      Main processing routine
      Specified by:
        `processIncoming` in interface `BaseStepExtender`
      Specified by:
        `processIncoming` in interface `Step`
      Overrides:
        `processIncoming` in class `BaseStep`
      Parameters:
        `data` - incoming data object
      Throws:
        `WekaException` - if a problem occurs

    - #### getCustomEditorForStep

          public java.lang.String getCustomEditorForStep()

      Return the fully qualified name of a custom editor component (JComponent) to use for editing the properties of the step. This method can return null, in which case the system will dynamically generate an editor using the GenericObjectEditor
      Specified by:
        `getCustomEditorForStep` in interface `Step`
      Overrides:
        `getCustomEditorForStep` in class `BaseStep`
      Returns:
        the fully qualified name of a step editor component