Esempio n. 1
0
 public void processNode()
 {
     if (propositionType.GetType() == typeof(AndClass))
     {
         sw.WriteLine($"{currentNode}[label = \"^\"]");
         sw.WriteLine($"{currentNode} -- {currentNode * 2}");
         sw.WriteLine($"{currentNode} -- {currentNode * 2 + 1}");
         //create children and set parent for the children
         List <IProposition> children = propositionType.getChildProposition();
         GraphNode           left     = new GraphNode(currentNode * 2, this, children[1], sw);
         GraphNode           right    = new GraphNode(currentNode * 2 + 1, this, children[0], sw);
     }
     else if (propositionType.GetType() == typeof(OrClass))
     {
         sw.WriteLine($"{currentNode}[label = \"||\"]");
         sw.WriteLine($"{currentNode} -- {currentNode * 2}");
         sw.WriteLine($"{currentNode} -- {currentNode * 2 + 1}");
         //create children and set parent for the children
         List <IProposition> children = propositionType.getChildProposition();
         GraphNode           left     = new GraphNode(currentNode * 2, this, children[1], sw);
         GraphNode           right    = new GraphNode(currentNode * 2 + 1, this, children[0], sw);
     }
     else if (propositionType.GetType() == typeof(ImplicationClass))
     {
         sw.WriteLine($"{currentNode}[label = \"=>\"]");
         sw.WriteLine($"{currentNode} -- {currentNode * 2}");
         sw.WriteLine($"{currentNode} -- {currentNode * 2 + 1}");
         //create children and set parent for the children
         List <IProposition> children = propositionType.getChildProposition();
         GraphNode           left     = new GraphNode(currentNode * 2, this, children[1], sw);
         GraphNode           right    = new GraphNode(currentNode * 2 + 1, this, children[0], sw);
     }
     else if (propositionType.GetType() == typeof(BiImplicationClass))
     {
         sw.WriteLine($"{currentNode}[label = \"<=>\"]");
         sw.WriteLine($"{currentNode} -- {currentNode * 2}");
         sw.WriteLine($"{currentNode} -- {currentNode * 2 + 1}");
         //create children and set parent for the children
         List <IProposition> children = propositionType.getChildProposition();
         GraphNode           left     = new GraphNode(currentNode * 2, this, children[1], sw);
         GraphNode           right    = new GraphNode(currentNode * 2 + 1, this, children[0], sw);
     }
     else if (propositionType.GetType() == typeof(NotClass))
     {
         sw.WriteLine($"{currentNode}[label = \"~\"]");
         sw.WriteLine($"{currentNode} -- {currentNode * 2}");
         //create children and set parent for the children
         List <IProposition> children = propositionType.getChildProposition();
         GraphNode           left     = new GraphNode(currentNode * 2, this, children[0], sw);
     }
     else
     {
         sw.WriteLine($"{currentNode}[label = \"{propositionType.GetString()}\"]");
     }
 }