Statistics
| Revision:

root / trunk / libraries / libExpressions / src / main / java / org / gvsig / operators / Exp.java @ 23299

History | View | Annotate | Download (1.41 KB)

1
package org.gvsig.operators;
2

    
3
import org.apache.bsf.BSFException;
4
import org.apache.bsf.BSFManager;
5
import org.gvsig.baseclasses.AbstractOperator;
6
import org.gvsig.baseclasses.IOperator;
7
import org.gvsig.expresions.EvalOperatorsTask;
8

    
9
/**
10
 * @author Vicente Caballero Navarro
11
 */
12
public class Exp extends AbstractOperator{
13

    
14
        public String addText(String s) {
15
                return toString()+"("+s+")";
16
        }
17
        public String toString() {
18
                return "exp";
19
        }
20
        public void eval(BSFManager interpreter) throws BSFException {
21
//                interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double exp(double value){return java.lang.Math.exp(value);};");
22
                interpreter.exec(EvalOperatorsTask.JYTHON,null,-1,-1,"def exp(value):\n" +
23
                                "  import java.lang.Math\n" +
24
                                "  return java.lang.Math.exp(value)");
25
        }
26
        public boolean isEnable() {
27
                return (getType()==IOperator.NUMBER);
28
        }
29
        public String getDescription() {
30
        return  "parameter" + ": " +
31
         "numeric_value" + "\n" +
32
         "returns" + ": " +
33
         "numeric_value" + "\n" +
34
         "description" + ": " +
35
        "Returns Euler's number e raised to the power of a double value. Special cases:\n" +
36
        "* If the argument is NaN, the result is NaN.\n" +
37
        "* If the argument is positive infinity, then the result is positive infinity.\n" +
38
        "* If the argument is negative infinity, then the result is positive zero.";
39
    }
40
}