Exemplo n.º 1
0
        /// <summary>
        /// Returns a flat list of all explain lines that are associated with specific fields
        /// </summary>
        /// <param name="explainLine">The explainLine to start from, if null uses the ExplainModel's first line</param>
        /// <param name="explainLines">Do not use from the initial calling method</param>
        /// <returns></returns>
        public List <ExplainLine> GetFieldExplainLines(ExplainLine explainLine = null, List <ExplainLine> explainLines = null, bool requireScorePercent = false)
        {
            if (explainLine == null)
            {
                explainLine = ExplainLine;
            }

            if (explainLines == null)
            {
                explainLines = new List <ExplainLine>();
            }

            if (!string.IsNullOrEmpty(explainLine.FieldName) && (explainLine.ScorePercent != 0 || requireScorePercent == false))
            {
                explainLines.Add(explainLine);
            }

            if (explainLine.Children == null)
            {
                return(explainLines);
            }

            foreach (var child in explainLine.Children)
            {
                GetFieldExplainLines(child, explainLines, requireScorePercent);
            }

            return(explainLines);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a child directly bellow this ExplainLine in the tree
        /// </summary>
        /// <param name="node"></param>
        public void AddChild(ExplainLine node)
        {
            // Set Child's parent
            node.Parent = this;

            // Add child
            if (Children == null)
            {
                Children = new List <ExplainLine>();
            }
            Children.Add(node);
        }