Statistics
| Revision:

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

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

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