Logo Search packages:      
Sourcecode: wims version File versions  Download package

void GenericGraphApplet::setUpParser (  )  [inline, protected]

This method is called by setUpMainPanel() to set up the parser to be used in the applet. When it is called, a parser already esists and is stored in the member variable named parser. This method configures the parser according to the values of the applet parameters "StandardFunctions", "Booleans", "OptionalStars", "OptionalParens", and "Factorials". It then looks for function defintions in applet parameters named "Define", "Define1", "Define2", ...., and if any are found the functions are added to the parser so that they can be used in expressions. A function definition can take a form such as "g(x)=x^2" or "fred(s,t) = 3*s + sin(t)", for example, or it can be defined by a table of values. A table function is defined using the syntax decribed in the parseTableFuncDef() method. Finally, a variable is created and added to the parser using the value of the applet param "Variable", with "x" as the default variable name.

Definition at line 451 of file GenericGraphApplet.java.

References edu::hws::jcm::data::Parser::add(), edu::hws::jcm::data::Parser::addOptions(), getParameter(), parser, and xVar.

Referenced by setUpMainPanel().

      if ( "yes".equalsIgnoreCase(getParameter("StandardFunctions", "yes")) )
      if ( "yes".equalsIgnoreCase(getParameter("Booleans", "yes")) )
      if ( ! "no".equalsIgnoreCase(getParameter("OptionalStars", "no")) )
      if ( ! "no".equalsIgnoreCase(getParameter("OptionalParens", "no")) )
      if ( ! "no".equalsIgnoreCase(getParameter("Factorials", "no")) )
      if ( "yes".equalsIgnoreCase(getParameter("Summations", "yes")) )
         parser.add(new SummationParser());
      String str = getParameter("Define");
      if (str != null)
      int ct = 1;
      while (true) {
         str = getParameter("Define" + ct);
         if (str == null)
      xVar = new Variable( getParameter("Variable", "x") );
      parser.add( xVar );

Generated by  Doxygen 1.6.0   Back to index