Statistics
| Revision:

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

History | View | Annotate | Download (1.62 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 Ceil extends AbstractOperator{
13

    
14
        public String addText(String s) {
15
                return toString()+"("+s+")";
16
        }
17
        public String toString() {
18
                return "ceil";
19
        }
20
        public void eval(BSFManager interpreter) throws BSFException {
21
//                interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double ceil(double value){return java.lang.Math.ceil(value);};");
22
                interpreter.exec(EvalOperatorsTask.JYTHON,null,-1,-1,"def ceil(value):\n" +
23
                                "  import java.lang.Math\n" +
24
                                "  return java.lang.Math.ceil(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 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" +
36
        "* If the argument value is already equal to a mathematical integer, then the result is the same as the argument.\n" +
37
        "* If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.\n" +
38
        "* If the argument value is less than zero but greater than -1.0, then the result is negative zero.\n";
39
    }
40

    
41
}