svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extExpressionField / src / com / iver / cit / gvsig / project / documents / table / operators / Ceil.java @ 27752
History | View | Annotate | Download (1.89 KB)
1 |
package com.iver.cit.gvsig.project.documents.table.operators; |
---|---|
2 |
|
3 |
import org.apache.bsf.BSFException; |
4 |
import org.apache.bsf.BSFManager; |
5 |
|
6 |
import com.iver.andami.PluginServices; |
7 |
import com.iver.cit.gvsig.ExpressionFieldExtension; |
8 |
import com.iver.cit.gvsig.project.documents.table.AbstractOperator; |
9 |
import com.iver.cit.gvsig.project.documents.table.IOperator; |
10 |
|
11 |
/**
|
12 |
* @author Vicente Caballero Navarro
|
13 |
*/
|
14 |
public class Ceil extends AbstractOperator{ |
15 |
|
16 |
public String addText(String s) { |
17 |
return toString()+"("+s+")"; |
18 |
} |
19 |
public String toString() { |
20 |
return "ceil"; |
21 |
} |
22 |
public void eval(BSFManager interpreter) throws BSFException { |
23 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double ceil(double value){return java.lang.Math.ceil(value);};");
|
24 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def ceil(value):\n" + |
25 |
" import java.lang.Math\n" +
|
26 |
" return java.lang.Math.ceil(value)");
|
27 |
} |
28 |
public boolean isEnable() { |
29 |
return (getType()==IOperator.NUMBER);
|
30 |
} |
31 |
public String getDescription() { |
32 |
return PluginServices.getText(this, "parameter") + ": " + |
33 |
PluginServices.getText(this, "numeric_value") + "\n" + |
34 |
PluginServices.getText(this, "returns") + ": " + |
35 |
PluginServices.getText(this, "numeric_value") + "\n" + |
36 |
PluginServices.getText(this, "description") + ": " + |
37 |
"Returns the smallest (closest to negative infinity) double value that is not less than the argument and is equal to a mathematical integer. Special cases:\n" +
|
38 |
"* If the argument value is already equal to a mathematical integer, then the result is the same as the argument.\n" +
|
39 |
"* If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.\n" +
|
40 |
"* If the argument value is less than zero but greater than -1.0, then the result is negative zero.\n";
|
41 |
} |
42 |
|
43 |
} |