Пример #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()}\"]");
     }
 }
 public SemanticTableux(IProposition ip, int _curNode, List <IProposition> toDraw)
 {
     isClosedNode             = false;
     graphviz                 = "";
     displayThisNode          = new List <string>();
     currentNode              = _curNode;
     toBeProcessedProposition = ip;
     leftProducts             = new List <IProposition>();
     rightProducts            = new List <IProposition>();
     nextNodes.Add(this);
     isSplit = isSplitOrNot();
     displayThisNode.Add(toBeProcessedProposition.GetString());
     if (toDraw != null)
     {
         foreach (IProposition pp in toDraw)
         {
             displayThisNode.Add(pp.GetString());
         }
     }
     DrawThisNode();
     DrawGraph();
 }
 public ProcessLogicClass(string raw)
 {
     rawString   = raw;
     proposition = ProcessString(raw);
     infix       = proposition.GetString();
 }
Пример #4
0
 public string GetString()
 {
     return($"({left.GetString()} ^ {right.GetString()})");
 }
Пример #5
0
 public string GetString()
 {
     return($"¬{proposition.GetString()}");
 }