public TreeNode(String question, bool isLastQuestion) { this.question = question; this.isLastQuestion = isLastQuestion; this.yes = null; this.no = null; }
public void insertQuestion(ref TreeNode t, String questionPath, String question, bool isLastQuestion) { if(String.IsNullOrEmpty(questionPath)){ t = new TreeNode(question, isLastQuestion); return; } if (questionPath[0].ToString().Equals("y")) // source: http://stackoverflow.com/questions/3878820/c-how-to-get-first-char-of-a-string { questionPath = questionPath.Remove(0, 1); insertQuestion(ref t.yes, questionPath, question, isLastQuestion); } else { questionPath = questionPath.Remove(0, 1); insertQuestion(ref t.no, questionPath, question, isLastQuestion); } }
public QuestionTree(String firstQuestion, bool isLastQuestion) { root = new TreeNode(firstQuestion, isLastQuestion); }