root / trunk / libraries / libExpressions / src / main / java / org / gvsig / operators / E.java @ 23299
History | View | Annotate | Download (1.17 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 E extends AbstractOperator{ |
13 |
|
14 |
public String addText(String s) { |
15 |
return s.concat(toString()+"()"); |
16 |
} |
17 |
public String toString() { |
18 |
return "e"; |
19 |
} |
20 |
public void eval(BSFManager interpreter) throws BSFException { |
21 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double e(){return java.lang.Math.E;};");
|
22 |
interpreter.exec(EvalOperatorsTask.JYTHON,null,-1,-1,"def e():\n" + |
23 |
" import java.lang.Math\n" +
|
24 |
" return java.lang.Math.E");
|
25 |
} |
26 |
public boolean isEnable() { |
27 |
return (getType()==IOperator.NUMBER);
|
28 |
} |
29 |
public String getTooltip(){ |
30 |
return "operator"+": "+addText("")+"\n"+getDescription(); |
31 |
} |
32 |
public String getDescription() { |
33 |
return "returns" + ": " + |
34 |
"numeric_value" + "\n" + |
35 |
"description" + ": " + |
36 |
"The double value that is closer than any other to e, the base of the natural logarithms.";
|
37 |
} |
38 |
} |