Пример #1
0
        /// <summary>
        /// Accepts a conjunctive-normal-form expression backwards applier visitor.
        /// </summary>
        /// <param name="visitor">CNF expression visitor.</param>
        public IElementCNF Accept(IElementCNFBackwardsApplierVisitor visitor)
        {
            ConditionsCNF newExpression = CloneEmpty();

            foreach (var conjunct in this)
            {
                var resultExpression = conjunct.Accept(visitor);
                if (resultExpression != null)
                {
                    newExpression.Add((IConjunctCNF)resultExpression);
                }
            }
            return(newExpression);
        }
Пример #2
0
        /// <summary>
        /// Accepts a conjunctive-normal-form expression backwards applier visitor.
        /// </summary>
        /// <param name="visitor">CNF expression visitor.</param>
        public IElementCNF Accept(IElementCNFBackwardsApplierVisitor visitor)
        {
            ClauseCNF newExpression = new ClauseCNF();

            foreach (var literal in this)
            {
                var resultExpression = literal.Accept(visitor);
                if (resultExpression == null)
                {
                    // any of element from the clause holds -> the whole clause holds
                    return(null);
                }
                else
                {
                    newExpression.Add((LiteralCNF)resultExpression);
                }
            }
            return(newExpression);
        }
Пример #3
0
 /// <summary>
 /// Accepts a conjunctive-normal-form expression backwards applier visitor.
 /// </summary>
 /// <param name="visitor">CNF expression visitor.</param>
 public override IElementCNF Accept(IElementCNFBackwardsApplierVisitor visitor)
 {
     return(visitor.Visit(this));
 }
Пример #4
0
 /// <summary>
 /// Accepts a conjunctive-normal-form expression backwards applier visitor.
 /// </summary>
 /// <param name="visitor">CNF expression visitor.</param>
 public abstract IElementCNF Accept(IElementCNFBackwardsApplierVisitor visitor);