//
//  MPSumFunction.m
//  MathKit
//
//  Created by Kim Wittenburg on 22.04.14.
//  Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//

#import "MPSumFunction.h"

#import "MPSumFunctionTerm.h"
#import "MPExpression.h"



@implementation MPSumFunction

MPFunctionAccessorImplementation(StartExpression, _startExpression)
MPFunctionAccessorImplementation(TargetExpression, _targetExpression)
MPFunctionAccessorImplementation(SumExpression, _sumExpression)


- (NSArray *)childrenAccessors
{
    return @[@"startExpression", @"targetExpression", @"sumExpression"];
}


- (BOOL)expectsVariableDefinitionInChildAtIndex:(NSUInteger)index
{
    return index == 0;
}


- (Class)functionTermClass
{
    return [MPSumFunctionTerm class];
}


- (NSString *)description
{
    return [NSString stringWithFormat:@"Sum(From: %@; To: %@; Using: %@)", self.startExpression, self.targetExpression, self.sumExpression];
}

@end
