Table of Contents

Class RuleElementVisitor<TContext>

Namespace
NRules.RuleModel
Assembly
NRules.RuleModel.dll

Visitor to traverse or rewrite rule definition (or its part).

public class RuleElementVisitor<TContext>

Type Parameters

TContext

Traversal context.

Inheritance
RuleElementVisitor<TContext>
Inherited Members

Methods

Visit(TContext, IRuleDefinition)

Visits a rule definition and all its nodes.

public IRuleDefinition Visit(TContext context, IRuleDefinition rule)

Parameters

context TContext

Traversal context.

rule IRuleDefinition

Rule definition.

Returns

IRuleDefinition

The original or a new rewritten rule definition.

Visit(TContext, RuleElement?)

Visits a rule element and all its descendant nodes.

public RuleElement? Visit(TContext context, RuleElement? element)

Parameters

context TContext

Traversal context.

element RuleElement

Rule element.

Returns

RuleElement

The original or a new rewritten rule element.

VisitAction(TContext, ActionElement)

protected virtual ActionElement VisitAction(TContext context, ActionElement element)

Parameters

context TContext
element ActionElement

Returns

ActionElement

VisitActionGroup(TContext, ActionGroupElement)

protected virtual ActionGroupElement VisitActionGroup(TContext context, ActionGroupElement element)

Parameters

context TContext
element ActionGroupElement

Returns

ActionGroupElement

VisitAggregate(TContext, AggregateElement)

protected virtual RuleElement VisitAggregate(TContext context, AggregateElement element)

Parameters

context TContext
element AggregateElement

Returns

RuleElement

VisitAnd(TContext, AndElement)

protected virtual RuleElement VisitAnd(TContext context, AndElement element)

Parameters

context TContext
element AndElement

Returns

RuleElement

VisitBinding(TContext, BindingElement)

protected virtual RuleElement VisitBinding(TContext context, BindingElement element)

Parameters

context TContext
element BindingElement

Returns

RuleElement

VisitDependency(TContext, DependencyElement)

protected virtual DependencyElement VisitDependency(TContext context, DependencyElement element)

Parameters

context TContext
element DependencyElement

Returns

DependencyElement

VisitDependencyGroup(TContext, DependencyGroupElement)

protected virtual DependencyGroupElement VisitDependencyGroup(TContext context, DependencyGroupElement element)

Parameters

context TContext
element DependencyGroupElement

Returns

DependencyGroupElement

VisitExists(TContext, ExistsElement)

protected virtual RuleElement VisitExists(TContext context, ExistsElement element)

Parameters

context TContext
element ExistsElement

Returns

RuleElement

VisitFilter(TContext, FilterElement)

protected virtual FilterElement VisitFilter(TContext context, FilterElement element)

Parameters

context TContext
element FilterElement

Returns

FilterElement

VisitFilterGroup(TContext, FilterGroupElement)

protected virtual FilterGroupElement VisitFilterGroup(TContext context, FilterGroupElement element)

Parameters

context TContext
element FilterGroupElement

Returns

FilterGroupElement

VisitForAll(TContext, ForAllElement)

protected virtual RuleElement VisitForAll(TContext context, ForAllElement element)

Parameters

context TContext
element ForAllElement

Returns

RuleElement

VisitNamedExpression(TContext, NamedExpressionElement)

protected virtual NamedExpressionElement VisitNamedExpression(TContext context, NamedExpressionElement element)

Parameters

context TContext
element NamedExpressionElement

Returns

NamedExpressionElement

VisitNot(TContext, NotElement)

protected virtual RuleElement VisitNot(TContext context, NotElement element)

Parameters

context TContext
element NotElement

Returns

RuleElement

VisitOr(TContext, OrElement)

protected virtual RuleElement VisitOr(TContext context, OrElement element)

Parameters

context TContext
element OrElement

Returns

RuleElement

VisitPattern(TContext, PatternElement)

protected virtual PatternElement VisitPattern(TContext context, PatternElement element)

Parameters

context TContext
element PatternElement

Returns

PatternElement

Visit<T>(TContext, IReadOnlyList<T>, Func<TContext, T, T>)

Visits each element in the collection and all their descendant nodes. If any of the elements is rewritten, a new collection is returned.

public static IReadOnlyList<T> Visit<T>(TContext context, IReadOnlyList<T> elements, Func<TContext, T, T> visitFunc) where T : RuleElement

Parameters

context TContext

Traversal context.

elements IReadOnlyList<T>

Collection of rule elements to visit.

visitFunc Func<TContext, T, T>

Concrete visitor delegate.

Returns

IReadOnlyList<T>

The original or a new rewritten collection of rule elements.

Type Parameters

T

Type of rule elements to visit.