Ejemplo n.º 1
0
 public void SearchRule(TreeNode Rule)
 {
     if (Rule.attribute.values != null)
     {
         string temp1 = "";
         Solution1 += Rule.attribute.AttributeName + " = ";
         temp1 += Solution1 + " ";
         for (int i = 0; i < Rule.attribute.values.Length; i++)
         {
             string temp2 = "";
             temp2 = temp1 + Rule.attribute.values[i] + ", ";
             TreeNode childNode = Rule.getChildByBranchName(Rule.attribute.values[i]);
             if (childNode.attribute.values == null)
             {
                 RuleCount++;
                 Solution1 = temp2 + "} THEN {" + childNode.attribute.mLabel + "}";
                 RuleID3.Add(Solution1);
             }
             else
             {
                 if (Rule.attribute.values == null)
                 {
                     SearchRule(childNode);
                 }
                 else
                 {
                     Solution1 = temp2;
                     SearchRule(childNode);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 public static void printNode(TreeNode root, string tabs)
 {
    
     Console.WriteLine(tabs + '|' + root.attribute + '|');
     TreeList += "\n" + tabs + '|' + root.attribute + '|';
     if (root.attribute.values != null)
     {
         for (int i = 0; i < root.attribute.values.Length; i++)
         {
             Console.WriteLine(tabs + "\t" + "<" + root.attribute.values[i] + ">");
             TreeList += "\n" + tabs + "\t" + "<" + root.attribute.values[i] + ">";
             TreeNode childNode = root.getChildByBranchName(root.attribute.values[i]);
             printNode(childNode, "\t" + tabs);
         }
     }
 }