#ifndef PROCESSDERIVATIVE #define PROCESSDERIVATIVE #include #include #include "VariableMap.h" #include "node.h" #include"globals.h" #include "OperatorMap.h" #include "ProcessString.h" /** *ProcessDerivative is a class that helps turn a string into nodes. It is a subclass of *ProcessString and inherits much of its functionality from this class. It is used by *NodeCreator in this program. ProcessDerivative is responsible for taking each *part of the string and looking up to see how each char of the string should *be dealt with. * *CONSTRUCTOR *ProcessDerivative(string & line, int & k, const VariableMap & variableMap) * *MEMBER FUNCTIONS * *void processBeginning() * This function looks at the string and strips off any unkonwn values, * or white space.It then alters the string so that the input will be * stored to current if no inital input was entered.Parses off first * variable, if entered, adds current otherwise.This version also looks to see if a binary * string is present. * *void processRest() * This function takes the rest of the string and turns them into * appropriate nodes. * *PRIVATE MEMBER FUNCTIONS * *void processBinaryFunction(string & binaryString) * This function checks for specific binary strings and calls the appropriate * function to deal with it. * *void processDeriv() * Processes the derivative by searching for the key and adding an empty string if no key found * *string findKey(int & position) * Searches until the key is found, then changes myLine so that the comma and key are removed * and returns the key *bool checkBinaryFunction( string & line, int & k, string & binaryString) * Checks if the current input is a binary function * * Node *findWord(string & line, int& position); * finds a string that is a word and processes it appropriately * *void processDeriviativeExpression(string & toDerivate); * Processes the interior part of the derivative *Written by Jessica Smith */ class ProcessDerivative : public ProcessString{ public: ProcessDerivative(string & line, int & position,const VariableMap & variableMap); virtual void processBeginning(); virtual void processRest(); private: void processBinaryFunction(string & binaryString); void processDeriv(); void processFunc(); double findValue( int & position); string findKey(int & position); bool checkBinaryFunction(string & line, int & position, string & binaryString); Node *findWord(string & line, int& position, string key, int value); void processInternalExpression(string & toEvaluate,string & key, double & value); }; #endif