Class NaryNode

Namespace
LogicalOptimizer
Assembly
LogicalOptimizer.Core.dll

Base class for the n-ary associative connectives of the canonical core (AndNode and OrNode). Holds a flat, immutable operand list of at least two entries. Structural equality is order-sensitive over the operand list (operand order is canonical for factory-built trees), and the hash code is computed once in the constructor — trees are fully immutable.

public abstract class NaryNode : AstNode
Inheritance
NaryNode
Derived
Inherited Members

Constructors

NaryNode(IReadOnlyList<AstNode>)

Low-level constructor: stores a defensive copy of operands as-is. No flattening, sorting, deduplication or constant folding is performed — build through FormulaFactory to get canonical trees.

protected NaryNode(IReadOnlyList<AstNode> operands)

Parameters

operands IReadOnlyList<AstNode>

Exceptions

ArgumentException

Fewer than two operands were supplied.

Properties

Operands

Flat operand list; always contains at least two entries.

public IReadOnlyList<AstNode> Operands { get; }

Property Value

IReadOnlyList<AstNode>

Operator

Operator symbol used when rendering (& or |).

public abstract string Operator { get; }

Property Value

string

Methods

Clone()

Nodes are fully immutable, so cloning returns the same instance.

public override AstNode Clone()

Returns

AstNode

Equals(object?)

Structural, order-sensitive equality: same runtime type and pairwise-equal operand lists.

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

GetVariables()

public override HashSet<string> GetVariables()

Returns

HashSet<string>

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.