Statistics
| Revision:

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

History | View | Annotate | Download (1.53 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 Min extends AbstractOperator{
12

    
13
        public String addText(String s) {
14
                return toString()+"("+s+")";
15
        }
16
        public String toString() {
17
                return "min";
18
        }
19
        public void eval(BSFManager interpreter) throws BSFException {
20
//                interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double min(double value1,double value2){return java.lang.Math.min(value1,value2);};");
21
                interpreter.exec(EvalOperatorsTask.JYTHON,null,-1,-1,"def min(value1, value2):\n" +
22
                                "  import java.lang.Math\n" +
23
                                "  return java.lang.Math.min(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 smaller of two int values. That is, the result the argument closer to the value of Integer.MIN_VALUE.\n" +
40
        "If the arguments have the same value, the result is that same value.";
41
    }
42
}