コード例 #1
0
        /// <summary>
        /// Creates a disjunction of the current conditions and the specified other conditions.
        /// </summary>
        /// <param name="other">Other conditions.</param>
        /// <returns>Disjunction of the current conditions and the given other conditions.</returns>
        public IConditions DisjunctionWith(IConditions other)
        {
            if (other is ConditionsContradiction)
            {
                return((IConditions)Clone());
            }

            ConditionsClause newClause = (ConditionsClause)Clone();

            ConditionsClause otherClause = other as ConditionsClause;

            if (otherClause != null)
            {
                foreach (var conditions in otherClause)
                {
                    newClause.Add((Conditions)conditions.Clone());
                }
            }
            else
            {
                Debug.Assert(other is Conditions);
                newClause.Add((Conditions)other.Clone());
            }

            return(newClause);
        }
コード例 #2
0
        /// <summary>
        /// Makes a deep copy of the conditions.
        /// </summary>
        /// <returns>Deep copy of the conditions.</returns>
        public Planner.IConditions Clone()
        {
            ConditionsClause clause = new ConditionsClause();

            foreach (var conditions in this)
            {
                clause.Add((Conditions)conditions.Clone());
            }
            return(clause);
        }