Branch Class

Summary

Evaluates the specified modules with each input document as the initial document and then outputs the original input documents without modification.
Assembly
Wyam.Core.dll
Namespace
Wyam.Core.Modules.Control
Interfaces
Base Types
graph BT Type-->Base0["ContainerModule"] click Base0 "/api/Wyam.Common.Modules/ContainerModule" Base0-->Base1["Object"] Type-.->Interface0["IModule"] click Interface0 "/api/Wyam.Common.Modules/IModule" Type-.->Interface1["IModuleList"] click Interface1 "/api/Wyam.Common.Modules/IModuleList" Type-.->Interface2["IList<IModule>"] Type["Branch"] class Type type-node

Syntax

public class Branch : ContainerModule, IModule, IModuleList, IList<IModule>

Examples

Assume you have a module, AddOne, that just adds 1 to whatever numeric value is in the content of the input document(s). The input and output content of the following pipeline should demonstrate what Branch does:
                    // Input Content      // Output Content
Pipelines.Add(
    AddOne(),       // [Empty]            // 0
    AddOne(),       // 0                  // 1
    AddOne(),       // 1                  // 2
    Branch(
        AddOne(),   // 2                  // 3
        AddOne()    // 3                  // 4
    ),
    AddOne(),       // 2                  // 3
    AddOne()        // 3                  // 4
);
You can see that the input content to the AddOne modules after the Branch is the same as the input content to the AddOne modules inside the branch. The result of the modules in the Branch had no impact on those modules that run after the Branch. This is true for both content and metadata. If any modules inside the Branch created or changed metadata, it would be forgotten once the Branch was done.

Remarks

This allows a sequence of modules to execute without impacting the "main" module sequence. In other words, Branch executes it's child modules as if there were no Branch module in the sequence, but then when it's child modules are done, the main sequence of modules is executed as if there were no Branch.

Constructors

Name Summary
Branch(IEnumerable<IModule>) Evaluates the specified modules with each input document as the initial document and then outputs the original input documents without modification.
Branch(IModule[]) Evaluates the specified modules with each input document as the initial document and then outputs the original input documents without modification.

Properties

Name Value Summary
Count int
Inherited from ContainerModule
IsReadOnly bool
Inherited from ContainerModule
this[int] IModule
Inherited from ContainerModule
this[string] IModule
Gets the module with the specified name.
Inherited from ContainerModule

Methods

Name Value Summary
Add(IModule) void
Inherited from ContainerModule
Add(IModule[]) void
Adds modules to the list. Any null items in the sequence of modules will be discarded.
Inherited from ContainerModule
Add(string, IModule) void
Adds a module to the list with a specified name.
Inherited from ContainerModule
AsKeyValuePairs() IEnumerable<KeyValuePair<string, IModule>>
Returns the list as a sequence of key-value pairs with the keys being the module names and the values being the module instances.
Inherited from ContainerModule
Clear() void
Inherited from ContainerModule
Contains(IModule) bool
Inherited from ContainerModule
Contains(string) bool
Determines if the list contains a module with the specified name.
Inherited from ContainerModule
CopyTo(IModule[], int) void
Inherited from ContainerModule
Execute(IReadOnlyList<IDocument>, IExecutionContext) IEnumerable<IDocument>
This should not be called directly, instead call IExecutionContext.Execute() if you need to execute a module from within another module.
GetEnumerator() IEnumerator<IModule>
Inherited from ContainerModule
IndexOf(IModule) int
Inherited from ContainerModule
IndexOf(string) int
Gets the index of the module with the specified name.
Inherited from ContainerModule
Insert(int, IModule) void
Inherited from ContainerModule
Insert(int, IModule[]) void
Inserts modules into the list. Any null items in the sequence of modules will be discarded.
Inherited from ContainerModule
Insert(int, string, IModule) void
Inserts a module into the list with a specified name.
Inherited from ContainerModule
Remove(IModule) bool
Inherited from ContainerModule
Remove(string) bool
Removes a module by name.
Inherited from ContainerModule
RemoveAt(int) void
Inherited from ContainerModule
TryGetValue(string, IModule) bool
Attempts to get a module with the specified name.
Inherited from ContainerModule
Where(DocumentConfig) Branch
Limits the documents passed to the child modules to those that satisfy the supplied predicate. All original input documents are output without modification regardless of whether they satisfy the predicate.
GitHub