Statistics
| Revision:

root / branches / v2_0_0_prep / extensions / extExpressionField / src / com / iver / cit / gvsig / project / documents / table / operators / Max.java @ 27752

History | View | Annotate | Download (2.22 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
 * @author Vicente Caballero Navarro
12
 */
13
public class Max extends AbstractOperator{
14

    
15
        public String addText(String s) {
16
                return toString()+"("+s+")";
17
        }
18
        public String toString() {
19
                return "max";
20
        }
21
        public void eval(BSFManager interpreter) throws BSFException {
22
//                interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double max(double value1,double value2){return java.lang.Math.max(value1,value2);};");
23
                interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def max(value1,value2):\n" +
24
                                "  import java.lang.Math\n" +
25
                                "  return java.lang.Math.max(value1,value2)");
26
        }
27
        public boolean isEnable() {
28
                return (getType()==IOperator.NUMBER);
29
        }
30
        public String getTooltip(){
31
                return PluginServices.getText(this,"operator")+":  "+toString()+ "("+ PluginServices.getText(this,"parameter")+"1,"+PluginServices.getText(this,"parameter")+"2"+")\n"+getDescription();
32
        }
33
        public String getDescription() {
34
        return PluginServices.getText(this, "parameter") + "1"+": " +
35
        PluginServices.getText(this, "numeric_value") + "\n"+
36
        PluginServices.getText(this, "parameter") + "2"+": " +
37
        PluginServices.getText(this, "numeric_value") + "\n"+
38
        PluginServices.getText(this, "returns") + ": " +
39
        PluginServices.getText(this, "numeric_value") + "\n" +
40
        PluginServices.getText(this, "description") + ": " +
41
        "Returns the greater of two double values. That is, the result is the argument closer to positive infinity. \n" +
42
        "If the arguments have the same value, the result is that same value. If either value is NaN, then the result is NaN.\n" +
43
        "Unlike the the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero.\n" +
44
        "If one argument is positive zero and the other negative zero, the result is positive zero.";
45
    }
46
}