com.pnpconsult.zeiterfassung.util
Class SimpleExpressionParser

java.lang.Object
  extended bycom.pnpconsult.zeiterfassung.util.SimpleExpressionParser

public class SimpleExpressionParser
extends java.lang.Object

Parses simple mathematical expressions from Strings into doubles.

Following expressions are valid:

  ["-"]param1[ "+"|"-"|"*"|"/" ["-"]param2["%"]]
 

Where param1 and param2 are numbers of the usual pattern: #.##0,00 (Localedependent). They are parsed using DecimalFormat.

Version:
$Id: SimpleExpressionParser.java,v 1.3 2004/05/23 16:59:41 powerpete Exp $
Author:
M. Petersen

Method Summary
static double parse(java.lang.String expression)
          Parses the given expression and returns the result as double.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parse

public static double parse(java.lang.String expression)
                    throws java.text.ParseException
Parses the given expression and returns the result as double.

Parameters:
expression - A valid expression.
Returns:
The parsed value.
Throws:
java.text.ParseException - If the expression could not be parsed.


Copyright © 2003-2004 PNP Unternehmensberatung. All Rights Reserved.