Exemple #1
0
        public static Expression Clone(Expression e)
        {
            Expression result;
            string     eType = e.GetType().Name;

            switch (eType)
            {
            case "NularyExpression": result = new NularyExpression((NularyExpression)e); break;

            case "UnaryExpression": result = new UnaryExpression((UnaryExpression)e); break;

            case "BinaryExpression": result = new BinaryExpression((BinaryExpression)e); break;

            case "NaryExpression": result = new NaryExpression((NaryExpression)e); break;

            default: throw new Exception("Неизвестный тип выражения: " + eType);
            }
            return(result);
        }
Exemple #2
0
 public NaryExpression(NaryExpression e)
     : base(e)
 {
     Operands = new List <Expression>();
     e.Operands.ForEach(o => Expression.Clone(o, this.Owner));
 }