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); }
public virtual void Visit(TermNode node){}
public override void Visit(TermNode node) { writer.WriteLine(node.ToString()); // writer.WriteLine(node.Token); }
public Term(TermNode node, bool polarity) { Polarity = polarity; TermNode = node; }
public Term(TermNode node) :this(node, node.Parent == null ? true : !(node.Parent is NegationNode)) { }
protected virtual IAstTreeNode Xform(TermNode node) { return null; }
public sealed override void Visit(TermNode node) { VisitAndXform(node, Xform(node)); }