Example #1
0
        ///<summary>
        /// Produces a string value for the Evaluation.  If compact is
        /// true then a more compact form of the description only including
        /// the node type and unique identifier is shown, else a full
        /// description including source and result are shown.  If showChildren
        /// is true the child evaluations are printed using the depth string
        /// given as a prefix.
        ///</summary>
        public string ToString(bool compact, bool showChildren, string depth)
        {
            string stringResult;

            if (compact)
            {
                stringResult = depth + "<" + node.GetType().Name + " " + this.GetHashCode() + ">";
            }
            else
            {
                string ss = (source != null) ? source.GetType().Name : "null",
                       rs = (result != null) ? result.GetType().Name : "null";

                stringResult = depth + "<" + node.GetType().Name + ": [" + (setOperation ? "set" : "get") + "] source = " + ss + ", result = " + result + " [" + rs + "]>";
            }
            if (showChildren)
            {
                Evaluation child = firstChild;

                stringResult += "\n";
                while (child != null)
                {
                    stringResult += child.ToString(compact, depth + "  ");
                    child         = child.next;
                }
            }
            return(stringResult);
        }