svn-gvsig-desktop / trunk / extensions / extExpressionField / src / com / iver / cit / gvsig / project / documents / table / operators / Equals.java @ 24544
History | View | Annotate | Download (1.84 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 |
/**
|
12 |
* @author Vicente Caballero Navarro
|
13 |
*/
|
14 |
public class Equals extends AbstractOperator{ |
15 |
|
16 |
public String addText(String s) { |
17 |
return toString()+"("+s+")"; |
18 |
} |
19 |
public String toString() { |
20 |
return "equals"; |
21 |
} |
22 |
public void eval(BSFManager interpreter) throws BSFException { |
23 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"boolean equals(java.lang.Object value1,java.lang.Object value2){return value1.equals(value2);};");
|
24 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1, |
25 |
"def equals(value1,value2):\n" +
|
26 |
" return value1 == value2");
|
27 |
} |
28 |
public boolean isEnable() { |
29 |
return (getType()==IOperator.STRING || getType()==IOperator.DATE);
|
30 |
} |
31 |
public String getTooltip(){ |
32 |
return PluginServices.getText(this,"operator")+": "+toString()+"("+PluginServices.getText(this,"parameter")+"1,"+PluginServices.getText(this,"parameter")+"2"+")"+"\n"+getDescription(); |
33 |
} |
34 |
public String getDescription() { |
35 |
return PluginServices.getText(this, "parameter") + "1"+": " + |
36 |
// PluginServices.getText(this, "string_value") + "\n"+
|
37 |
PluginServices.getText(this, "parameter") + "2"+": " + |
38 |
// PluginServices.getText(this, "string_value") + "\n"+
|
39 |
PluginServices.getText(this, "returns") + ": " + |
40 |
PluginServices.getText(this, "boolean_value") + "\n" + |
41 |
PluginServices.getText(this, "description") + ": " + |
42 |
"Compares the parameter1 to the parameter2. The result is true if and only if the arguments are not null and represents the same object.";
|
43 |
} |
44 |
} |