Ejemplo n.º 1
0
 public double Calculate()
 {
     if (Root_Node)
     {
         return(Value);
     }
     if (Left == null)
     {
         return(Perform_Action(Right.Calculate()));
     }
     if (Right == null)
     {
         return(Perform_Action(Left.Calculate()));
     }
     return(Perform_Action(Left.Calculate(), Right.Calculate()));
 }
Ejemplo n.º 2
0
        /*
         *---------------------------One of the most important functions of the program----------------------------------------
         * Called when the equal sign is written
         */
        private double Calculate_Value()
        {
            List <Mouse_Data> L = new List <Mouse_Data>();

            for (int i = 0; i < Screen.Count; i++)
            {
                Mouse_Data D = Screen[i];
                if (D.Label != "equals" && !D.Calculated)
                {
                    L.Add(D);
                }
                Screen[i].Calculated = true;
            }
            Math_Node Tree = new Math_Node(L);

            return(Tree.Calculate());
        }