コード例 #1
0
ファイル: QuestionTree.cs プロジェクト: FabioCZ/UsuCs2412
 public TreeNode(String question, bool isLastQuestion)
 {
     this.question = question;
     this.isLastQuestion = isLastQuestion;
     this.yes = null;
     this.no = null;
 }
コード例 #2
0
ファイル: QuestionTree.cs プロジェクト: FabioCZ/UsuCs2412
 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);
     }
 }
コード例 #3
0
ファイル: QuestionTree.cs プロジェクト: FabioCZ/UsuCs2412
 public QuestionTree(String firstQuestion, bool isLastQuestion)
 {
     root = new TreeNode(firstQuestion, isLastQuestion);
 }