root / trunk / libraries / libExpressions / src / main / java / org / gvsig / operators / Equals.java @ 23299
History | View | Annotate | Download (1.47 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 Equals extends AbstractOperator{ |
13 |
|
14 |
public String addText(String s) { |
15 |
return toString()+"("+s+", \"\")"; |
16 |
} |
17 |
public String toString() { |
18 |
return "equals"; |
19 |
} |
20 |
public void eval(BSFManager interpreter) throws BSFException { |
21 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"boolean equals(java.lang.Object value1,java.lang.Object value2){return value1.equals(value2);};");
|
22 |
interpreter.exec(EvalOperatorsTask.JYTHON,null,-1,-1,"def equals(value1,value2):\n" + |
23 |
" return value1 == value2");
|
24 |
} |
25 |
public boolean isEnable() { |
26 |
return (getType()==IOperator.STRING || getType()==IOperator.DATE);
|
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 |
"string_value" + "\n"+ |
34 |
"parameter" + "2"+": " + |
35 |
"string_value" + "\n"+ |
36 |
"returns" + ": " + |
37 |
"boolean_value" + "\n" + |
38 |
"description" + ": " + |
39 |
"Compares the parameter1 to the parameter2. The result is true if and only if the arguments are not null and represents the same object.";
|
40 |
} |
41 |
} |