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
operandsIReadOnlyList<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
Operator
Operator symbol used when rendering (& or |).
public abstract string Operator { get; }
Property Value
Methods
Clone()
Nodes are fully immutable, so cloning returns the same instance.
public override AstNode Clone()
Returns
Equals(object?)
Structural, order-sensitive equality: same runtime type and pairwise-equal operand lists.
public override bool Equals(object? obj)
Parameters
objobject
Returns
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
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.