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

double [] GenericGraphApplet::getNumericParam ( String  paramName,
double[]  defaults 
) [inline, protected]

Get The value of an applet parameter that consists of a list of numbers. The parameter value, if any, is parsed and returned as array of double values. The numbers can be separated by commas, spaces, tabs, or semicolons.

Parameters:
paramName The name of the applet parameter.
defaultValue The value to be returned if getParameter(paramName) is null or is not a valid list of numbers.

Definition at line 539 of file GenericGraphApplet.java.

References getParameter().

                                                                           {
      String data = getParameter(paramName);
      if (data == null)
         return defaults;
      StringTokenizer tokenizer = new StringTokenizer(data," \t,;");
      int count = tokenizer.countTokens();
      if (count == 0) 
         return defaults;
      double[] numbers = new double[count];
      for (int i = 0; i < count; i++) {
         try {
            Double d = new Double(tokenizer.nextToken());
            numbers[i] = d.doubleValue();
         }
         catch (NumberFormatException e) {
            return defaults;
         }
      }
      return numbers;
   }


Generated by  Doxygen 1.6.0   Back to index