cascading.flow.planner.rule

## Class RuleRegistrySet

- java.lang.Object
- - cascading.flow.planner.rule.RuleRegistrySet

    public class RuleRegistrySet
    extends java.lang.Object

Class RuleRegistrySet manages the set of `RuleRegistry` instances that should be applied via the `FlowPlanner` to the given assembly.

The current RuleRegistrySet can be reached via `FlowConnector.getRuleRegistrySet()`, or set with the appropriate `FlowConnector` constructor sub-class.

RuleRegistrySet configuration is mutable to address different situations.

During planner execution, all RuleRegistry instances are applied simultaneously within individual threads.

If the planner duration exceeds `getPlannerTimeoutSec()` (with default `RuleSetExec.DEFAULT_TIMEOUT`) any incomplete planner executions will be cancelled.

If no planner executions complete successfully within the timeout period, an exception will be thrown.

If there are multiple successful completions, the default cost comparator, `RuleSetExec.DEFAULT_PLAN_COMPARATOR`, will be applied to find the lower cost plan. Use `setPlanComparator(java.util.Comparator)` to override.

If all plans have equivalent costs, the plan corresponding to the first most RuleRegistry, as given to the RuleRegistrySet, will be selected.

If `setSelect(cascading.flow.planner.rule.RuleRegistrySet.Select)` is set to `RuleRegistrySet.Select.FIRST`, the first RuleRegistry to complete will be used regardless of cost ordering provided by the plan Comparator. All remaining running planner executions will be cancelled.

If `isIgnoreFailed()` is `false`, if any planner execution is times out or fails, an exception will be thrown.

### Nested Class Summary

Nested Classes
`static class` `RuleRegistrySet.Select`

### Constructor Summary

Constructors
Constructor and Description
`RuleRegistrySet(java.util.Collection<RuleRegistry> ruleRegistries)` Instantiates a new Rule Registry Set.
`RuleRegistrySet(RuleRegistry... ruleRegistries)` Instantiates a new Rule Registry Set.

### Method Summary

Methods
`RuleRegistry` `findRegistryWith(java.lang.String ruleName)`
`java.util.Comparator<RuleResult>` `getPlanComparator()` Returns planner comparator.
`int` `getPlannerTimeoutSec()` Gets planner timeout, in seconds.
`RuleRegistrySet.Select` `getSelect()` Returns the result selection type.
`protected int` `indexOf(RuleRegistry ruleRegistry)`
`boolean` `isIgnoreFailed()` When true, failures during planning will be ignored unless no registries are successful.
`void` `setIgnoreFailed(boolean ignoreFailed)` Sets ignore failed setting.
`void` `setPlanComparator(java.util.Comparator<RuleResult> planComparator)` Sets planner result comparator, used only if `getSelect()` is `RuleRegistrySet.Select.COMPARED`.
`void` `setPlannerTimeoutSec(int plannerTimeoutSec)` Sets planner timeout, in seconds.
`void` `setSelect(RuleRegistrySet.Select select)` Sets the result selection type.
`int` `size()`

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

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

### Constructor Detail

#### RuleRegistrySet

    public RuleRegistrySet(RuleRegistry... ruleRegistries)

Instantiates a new Rule Registry Set.

Parameters:
  `ruleRegistries` - the rule registries

#### RuleRegistrySet

    public RuleRegistrySet(java.util.Collection<RuleRegistry> ruleRegistries)

Instantiates a new Rule Registry Set.

Parameters:
  `ruleRegistries` - the rule registries

### Method Detail

#### getPlannerTimeoutSec

    public int getPlannerTimeoutSec()

Gets planner timeout, in seconds.

Returns:
  the planner timeout sec

#### setPlannerTimeoutSec

    public void setPlannerTimeoutSec(int plannerTimeoutSec)

Sets planner timeout, in seconds.

Extremely large assemblies may take longer than the default timeout. This allows for increasing that timeout period when necessary.

Parameters:
  `plannerTimeoutSec` - the planner timeout sec

#### isIgnoreFailed

    public boolean isIgnoreFailed()

When true, failures during planning will be ignored unless no registries are successful. When false, any failure will cause the planner to fail.

Returns:
  type boolean

#### setIgnoreFailed

    public void setIgnoreFailed(boolean ignoreFailed)

Sets ignore failed setting. The default is `true`.

When `true`, failures during planning will be ignored unless no registries are successful. When `false`, any failure will cause the planner to fail.

Parameters:
  `ignoreFailed` - `true` if any failures should be ignored, the default

#### getSelect

    public RuleRegistrySet.Select getSelect()

Returns the result selection type.

Returns:
  the selection type

#### setSelect

    public void setSelect(RuleRegistrySet.Select select)

Sets the result selection type.

Parameters:
  `select` - the selection type

#### getPlanComparator

    public java.util.Comparator<RuleResult> getPlanComparator()

Returns planner comparator.

Returns:
  the planner result comparator

#### setPlanComparator

    public void setPlanComparator(java.util.Comparator<RuleResult> planComparator)

Sets planner result comparator, used only if `getSelect()` is `RuleRegistrySet.Select.COMPARED`.

Parameters:
  `planComparator` - the plan comparator

#### size

    public int size()

#### findRegistryWith

    public RuleRegistry findRegistryWith(java.lang.String ruleName)

#### indexOf

    protected int indexOf(RuleRegistry ruleRegistry)