Ejemplo n.º 1
0
 public override void Visit(AndNode node)
 {
     if (!(node.Parent is L1Expression))
     {
         throw new NotSupportedException(String.Format(
             "Not a CNF or fatal error: '{0}", node.Parent));
     }
 }
Ejemplo n.º 2
0
        protected override IAstTreeNode Xform(OrNode node)
        {
            foreach(var child in node.Children)
            {
                if (child is AndNode)
                {
                    var restOfDisjunction = (IAstTreeNode)node.Clone();
                    restOfDisjunction.Children.RemoveAll(cchild => cchild.Id == child.Id);

                    var result = new AndNode();
                    foreach(var conjunct in child.Children.Snapshot())
                    {
                        var disjunction = new OrNode();
                        disjunction.Children.Add(conjunct);
                        disjunction.Children.AddRange(restOfDisjunction.Children);
                        result.Children.Add(disjunction);
                    }

                    return result;
                }
            }

            return null;
        }
Ejemplo n.º 3
0
 public virtual void Visit(AndNode node){}
Ejemplo n.º 4
0
 protected virtual IAstTreeNode Xform(AndNode node) { return null; }
Ejemplo n.º 5
0
 public sealed override void Visit(AndNode node) { VisitAndXform(node, Xform(node)); }