Danmaku_no_Kyojin.BulletEngine.Equationator.BaseNode.GetHighestPemdas C# (CSharp) Method

GetHighestPemdas() private method

Gets the highest pemdas.
private GetHighestPemdas ( ) : BaseNode
return BaseNode
        private BaseNode GetHighestPemdas()
        {
            Debug.Assert(null != Next);
            BaseNode RootNode = this;
            for  (BaseNode iter = Next; iter != null; iter = iter.Next)
            {
                //if we found a subtraction node, that is the highest value
                if (PemdasValue.Subtraction ==  RootNode.OrderOfOperationsValue)
                {
                    break;
                }
                else if (iter.OrderOfOperationsValue > RootNode.OrderOfOperationsValue)
                {
                    //The next node has a higher value than the current champion
                    RootNode = iter;
                }
            }

            //ok, return the node we found with the highest value.
            return RootNode;
        }