Beispiel #1
0
        public override void Visit(TermNode node)
        {
            Term term;
            IAstTreeNode clauseRoot;

            if (node.Parent is NegationNode)
            {
                term = new Term(node, false);
                clauseRoot = node.Parent.Parent;
            }
            else if (node.Parent is OrNode || node.Parent is L1Expression)
            {
                term = new Term(node, true);
                clauseRoot = node.Parent;
            }
            else if (node.Parent is AndNode)
            {
                term = new Term(node, true);
                clauseRoot = node;
            }
            else
            {
                throw new NotSupportedException(String.Format(
                    "Not a CNF or fatal error: '{0}", node.Parent));
            }

            if (!_clauses.ContainsKey(clauseRoot)) _clauses[clauseRoot] = new Clause();
            _clauses[clauseRoot].Terms.Add(term);
        }
Beispiel #2
0
 public virtual void Visit(TermNode node){}
Beispiel #3
0
        public override void Visit(TermNode node)
        {
            writer.WriteLine(node.ToString());
//            writer.WriteLine(node.Token);
        }
Beispiel #4
0
 public Term(TermNode node, bool polarity)
 {
     Polarity = polarity;
     TermNode = node;
 }
Beispiel #5
0
 public Term(TermNode node)
     :this(node, node.Parent == null ? true : !(node.Parent is NegationNode))
 {
 }
Beispiel #6
0
 protected virtual IAstTreeNode Xform(TermNode node) { return null; }
Beispiel #7
0
 public sealed override void Visit(TermNode node) { VisitAndXform(node, Xform(node)); }