Class AstMetrics

Namespace
LogicalOptimizer
Assembly
LogicalOptimizer.Core.dll

Size and shape metrics over expression trees. Cost model: an n-ary And/Or node counts as ONE node (and one operator) regardless of its operand count — the flat list is a single connective, not a chain of binary ones.

public static class AstMetrics
Inheritance
AstMetrics
Inherited Members

Methods

CountLiterals(AstNode)

Number of variable occurrences (constants excluded)

public static int CountLiterals(AstNode node)

Parameters

node AstNode

Returns

int

CountNodes(AstNode)

Total node count; an n-ary node counts as 1 plus its operands.

public static int CountNodes(AstNode node)

Parameters

node AstNode

Returns

int

CountOperators(AstNode)

Operator count; an n-ary connective counts as one operator.

public static int CountOperators(AstNode node)

Parameters

node AstNode

Returns

int

GetDepth(AstNode)

Tree depth; an n-ary node contributes one level over its deepest operand.

public static int GetDepth(AstNode node)

Parameters

node AstNode

Returns

int