//
//  MPProductFunction.h
//  MathPad
//
//  Created by Kim Wittenburg on 10.01.15.
//  Copyright (c) 2015 Kim Wittenburg. All rights reserved.
//

#import "MPFunction.h"


/*!
 @header
 This file contains the <code>MPProductFunction</code> class.
 */



@class MPProductFunction, MPExpression;


/*!
    @class      MPProductFunction
    @abstract   This class represents a product function (generally noted using a
                capital pi).
 
    @discussion A product function has a start and a target expression indicating
                how often the product expression should be evaluated. Both the
                value of the start expression and the target expressions are
                included in the iterations.
 
                Each iteration the iteration value is incremented by
                <code>1</code>. If the start and target expression evaluate to
                the same value the product is evaluated once.
 */
@interface MPProductFunction : MPFunction

/*!
    @property   startExpression
    @abstract   The value of the first iteration.
 
    @discussion The start expression must define a variable that may be used in
                the sum expression. If the start expression does not define a
                variable the product function will not be evaluatable.
 */
@property (nonatomic, strong) MPExpression *startExpression; /* Index 0 */


/*!
    @property   targetExpression
    @abstract   The value if the last iteration.
 
    @discussion The target expression must not define a variable.
 */
@property (nonatomic, strong) MPExpression *targetExpression; /* Index 1 */


/*!
    @property   productExpression
    @abstract   The product expression evaluated multiple times.
 
    @discussion During evaluation of the product expression the variable defined
                in the start expression is available. That variable always
                contains the value of the current iteration.
 
                The product expression itself must not define a variable.
 */
@property (nonatomic, strong) MPExpression *productExpression; /* Index 2 */

@end
