示例#1
0
        /// <summary>
        /// Adds a new Substitution to this set.
        /// The adding process might fail, if the addition of the new Substitution would create a conflict.
        /// </summary>
        /// <param name="substitution">The Substitution to add to this set.</param>
        /// <returns>True if the substitution was sucessfully added to the set. False otherwise.</returns>
        /// <remarks>
        /// If the given Substitution already exists in this set, this method will return true as if it
        /// was successfully added, but it would not produce any changes to the underlying set.
        /// </remarks>
        public bool AddSubstitution(Substitution substitution)
        {
            bool canAdd;

            if (m_impl.TestConflict(substitution, this, out canAdd))
            {
                return(false);
            }

            if (canAdd)
            {
                m_impl.AddSubstitution(substitution);
            }

            return(true);
        }