01: // Copyright © 2004-2005 ASERT. Released under the Canoo Webtest license.
02: package com.canoo.webtest.util;
03:
04: /**
05: * Evaluator is a callback interface for the Expression class.
06: * Objects wanting to define special values to be parsed in expressions
07: * should supply an Evaluator instance that converts a string value
08: * into it's double value.
09: * <p/>
10: * For example, to parse "2*(3-PI)", evaluate will be called with the value
11: * "PI", which should return the value Math.PI. The whole expression will then
12: * evaluate to 0.283
13: *
14: * @author Paul King
15: * @author Rob Nielsen
16: */
17: public interface Evaluator {
18: /**
19: * Evaluates a special string value.
20: *
21: * @param s the string to evaluate
22: * @return the double value of the string
23: * @throws IllegalArgumentException if there is a problem parsing the parameter
24: */
25: double evaluate(String s);
26: }
|