/* plotFunc.m  by Paul Kunz	December 1992
 * Category extension to Plot class dealing with functions
 *
 * Copyright (C)  1992  The Board of Trustees of
 * The Leland Stanford Junior University. All Rights Reserved.
 */

#import "Plot.h"

#import "PFunction.h"

const char plotFunc_m_rcsid[] = "$Id: plotFunc.m,v 2.5 1993/04/02 23:30:55 pfkeb Exp $";

@implementation Plot(Function)

- addFunction:(PFunction *)pFunc
{
    [pFunc addToPlot:self];
    if ( !funcList ) {
        funcList = [[List allocFromZone:[self zone]] initCount:0];
    }
    [funcList addObject:pFunc];
    return self;
}
- replaceDispFuncs
{
    PFunction	*pfunc;
    int		i, count;
    
    count = [funcList count];
    for ( i = 0; i < count; i++ ) {
        pfunc = [funcList objectAt:i];
	[pfunc resetAfterRead:self];
	[pfunc resetParms];
    }
    return self;
}
- removeFunction:(PFunction *)pFunc
{
    [pFunc removeFromPlot:self];
    [funcList removeObject:pFunc];
    return self;
}
- (BOOL) hasFunction
{
   if ( funcList && [funcList count] ) {
       return YES;
   }
   return NO;
}
- (List *) functionList
{
    return funcList;
}
@end
