Statistics
| Revision:

root / org.gvsig.expressionfield / trunk / org.gvsig.expressionfield / src / main / java / org / gvsig / expressionfield / project / documents / table / operators / Floor.java @ 22

History | View | Annotate | Download (1.64 KB)

1
package org.gvsig.expressionfield.project.documents.table.operators;
2

    
3
import org.apache.bsf.BSFException;
4
import org.apache.bsf.BSFManager;
5
import org.gvsig.andami.PluginServices;
6
import org.gvsig.expressionfield.ExpressionFieldExtension;
7
import org.gvsig.expressionfield.project.documents.table.AbstractOperator;
8
import org.gvsig.expressionfield.project.documents.table.IOperator;
9

    
10

    
11
/**
12
 * @author Vicente Caballero Navarro
13
 */
14
public class Floor extends AbstractOperator{
15

    
16
        public String addText(String s) {
17
                return toString()+"("+s+")";
18
        }
19
        public String toString() {
20
                return "floor";
21
        }
22
        public void eval(BSFManager interpreter) throws BSFException {
23
                interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def floor(value):\n" +
24
                                "  import java.lang.Math\n" +
25
                                "  return java.lang.Math.floor(value)");
26
        }
27
        public boolean isEnable() {
28
                return (getType()==IOperator.NUMBER);
29
        }
30
        public String getDescription() {
31
        return PluginServices.getText(this, "parameter") + ": " +
32
        PluginServices.getText(this, "numeric_value") + "\n" +
33
        PluginServices.getText(this, "returns") + ": " +
34
        PluginServices.getText(this, "numeric_value") + "\n" +
35
        PluginServices.getText(this, "description") + ": " +
36
        "Returns the largest (closest to positive infinity) double value that is not greater than the argument and is equal to a mathematical integer. Special cases:\n" +
37
        "* If the argument value is already equal to a mathematical integer, then the result is the same as the argument.\n" +
38
        "* If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.\n";
39
    }
40

    
41
}