Class PolicyComposition
Factory methods for composing multiple mutation policies into one deterministic policy.
Inherited Members
Namespace: ModularityKit.Mutator.Abstractions.Policies
Assembly: ModularityKit.Mutator.dll
Syntax
public static class PolicyComposition
Methods
| Edit this page View SourceAllOf<TState>(string, IEnumerable<IMutationPolicy<TState>>, int, string?)
Creates composed policy that requires every child policy to allow the mutation.
Declaration
public static IMutationPolicy<TState> AllOf<TState>(string name, IEnumerable<IMutationPolicy<TState>> policies, int priority = 0, string? description = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The composed policy name. |
| IEnumerable<IMutationPolicy<TState>> | policies | The child policies to evaluate. |
| int | priority | The priority of the composed policy. |
| string | description | An optional human readable description. |
Returns
| Type | Description |
|---|---|
| IMutationPolicy<TState> | A composed policy that merges all child decisions. |
Type Parameters
| Name | Description |
|---|---|
| TState | The state type handled by the composed policy. |
AnyOf<TState>(string, IEnumerable<IMutationPolicy<TState>>, int, string?)
Creates composed policy that succeeds when at least one child policy allows the mutation.
Declaration
public static IMutationPolicy<TState> AnyOf<TState>(string name, IEnumerable<IMutationPolicy<TState>> policies, int priority = 0, string? description = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The composed policy name. |
| IEnumerable<IMutationPolicy<TState>> | policies | The child policies to evaluate. |
| int | priority | The priority of the composed policy. |
| string | description | An optional human readable description. |
Returns
| Type | Description |
|---|---|
| IMutationPolicy<TState> | A composed policy that selects the allowed branch when one exists. |
Type Parameters
| Name | Description |
|---|---|
| TState | The state type handled by the composed policy. |
Priority<TState>(string, IEnumerable<IMutationPolicy<TState>>, int, string?)
Creates a composed policy that evaluates children in deterministic priority order and returns the first decisive result.
Declaration
public static IMutationPolicy<TState> Priority<TState>(string name, IEnumerable<IMutationPolicy<TState>> policies, int priority = 0, string? description = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The composed policy name. |
| IEnumerable<IMutationPolicy<TState>> | policies | The child policies to evaluate. |
| int | priority | The priority of the composed policy. |
| string | description | An optional human readable description. |
Returns
| Type | Description |
|---|---|
| IMutationPolicy<TState> | A composed policy that stops at the first decisive child decision. |
Type Parameters
| Name | Description |
|---|---|
| TState | The state type handled by the composed policy. |