public void PrintInorder(MathExpressionNode node, ref string expression)
 {
     if (node == null)
         return;
     PrintInorder(node.LeftChild, ref expression);
     expression += node.ToString();
     PrintInorder(node.RightChild, ref expression);
 }
Exemple #2
0
 public override void SubstiteValue(MathExpressionNode otherNode)
 {
     if (!(otherNode is Operator substitute))
     {
         throw new Exception();
     }
     CorrespondingFunction = substitute.CorrespondingFunction;
     OperationSign         = substitute.OperationSign;
     Operation             = substitute.Operation;
 }
Exemple #3
0
        public override MathExpressionNode Copy(MathExpressionNode parent)
        {
            Operator newOperator = new Operator(Operation)
            {
                Parent = parent
            };

            newOperator.LeftChild  = LeftChild.Copy(newOperator);
            newOperator.RightChild = RightChild.Copy(newOperator);
            return(newOperator);
        }
 public MathExpressionTree(MathExpressionNode root)
 {
     this.Root = root;
 }
 public MathExpressionTree Copy()
 {
     MathExpressionNode rootNode = Root.Copy(null);
     return new MathExpressionTree(rootNode);
 }