Esempio n. 1
0
        /// <summary>
        /// <see cref="IElement.Clone" />
        /// </summary>
        public override object Clone()
        {
            var not = new NOT();

            if (_condition != null)
            {
                not.SetCondition((ICondition)_condition.Clone());
            }
            return(not);
        }
Esempio n. 2
0
        /// <summary>
        /// Calls a replace handler recursively.
        /// </summary>
        /// <param name="c">The condition object to convert.</param>
        /// <param name="replacer">The replace method.</param>
        /// <returns>The converted object.</returns>
        /// <remarks>
        /// <para>This method leaves the original condition intact.</para>
        /// </remarks>
        public static ICondition Replace(this ICondition c, Func <ICondition, ICondition> replacer)
        {
            var r = c.Clone();

            for (int j = 0; j < r.Elements.Count; ++j)
            {
                r.Elements[j] = replacer(r.Elements[j]);
            }

            return(replacer(r));
        }
        /// <summary>
        /// <see cref="IElement.Clone" />
        /// </summary>
        public override object Clone()
        {
            var conditional = new ConditionalInstruction();

            if (_ifCondition != null)
            {
                conditional.IFCondition = (ICondition)_ifCondition.Clone();
            }
            if (_ifInstruction != null)
            {
                conditional.IFInstruction = (IInstruction)_ifInstruction.Clone();
            }
            if (_elseInstruction != null)
            {
                conditional.ELSEInstruction = (IInstruction)_elseInstruction.Clone();
            }
            return(conditional);
        }