public DynamicExpressionData(
            OperatorBuilder topOperator,
            ParameterExpression[] orderedParameters)
        {
            OgExpressionStringValue = topOperator.ToString();
            var builderQueue = new Queue <OperatorBuilder>();

            builderQueue.Enqueue(topOperator);

            while (builderQueue.Count > 0)
            {
                var nextNode = builderQueue.Dequeue();
                if (nextNode.type == OperatorType.CONSTANT_VALUE)
                {
                    definitionList.Add(new OperatorDefinition
                    {
                        operatorType = OperatorType.CONSTANT_VALUE,
                        nodeValue    = nextNode.nodeValue
                    });
                }
                else if (nextNode.type == OperatorType.PARAMETER_VALUE)
                {
                    var paramIndex = Array.IndexOf(orderedParameters, nextNode.parameter);
                    definitionList.Add(new OperatorDefinition
                    {
                        operatorType   = OperatorType.PARAMETER_VALUE,
                        parameterIndex = paramIndex
                    });
                }
                else if (nextNode.IsUnary)
                {
                    var rhsIndex = definitionList.Count + builderQueue.Count + 1;
                    definitionList.Add(new OperatorDefinition
                    {
                        operatorType = nextNode.type,
                        rhs          = (ushort)rhsIndex
                    });
                    builderQueue.Enqueue(nextNode.rhs);
                }
                else if (nextNode.IsBinary)
                {
                    var lhsIndex = definitionList.Count + builderQueue.Count + 1;
                    var rhsIndex = definitionList.Count + builderQueue.Count + 2;
                    definitionList.Add(new OperatorDefinition
                    {
                        operatorType = nextNode.type,
                        lhs          = (ushort)lhsIndex,
                        rhs          = (ushort)rhsIndex
                    });
                    builderQueue.Enqueue(nextNode.lhs);
                    builderQueue.Enqueue(nextNode.rhs);
                }
                else
                {
                    throw new Exception("unrecognized node type");
                }
            }
        }
        public override string ToString()
        {
            if (type == OperatorType.CONSTANT_VALUE)
            {
                return(nodeValue.ToString("f1"));
            }
            if (type == OperatorType.PARAMETER_VALUE)
            {
                return($"PARAMAT({parameter})");
            }
            var str = Enum.GetName(typeof(OperatorType), type) + "(";

            if (lhs != null)
            {
                str += lhs.ToString() + ", ";
            }
            if (rhs != null)
            {
                str += rhs.ToString();
            }
            str += ")";
            return(str);
        }