Revision 103
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/buildNumber.properties | ||
---|---|---|
1 |
#Sat Oct 24 13:52:04 CEST 2015 |
|
2 |
buildNumber=2093 |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/test/java/org/gvsig/expressionfield/AllTests.java | ||
---|---|---|
1 |
package org.gvsig.expressionfield; |
|
2 |
|
|
3 |
import junit.framework.Test; |
|
4 |
import junit.framework.TestSuite; |
|
5 |
|
|
6 |
public class AllTests { |
|
7 |
|
|
8 |
public static Test suite() { |
|
9 |
TestSuite suite = new TestSuite( |
|
10 |
"Test for com.iver.cit.gvsig.expressionField"); |
|
11 |
//$JUnit-BEGIN$ |
|
12 |
|
|
13 |
//$JUnit-END$ |
|
14 |
return suite; |
|
15 |
} |
|
16 |
|
|
17 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<!-- |
|
2 |
|
|
3 |
gvSIG. Desktop Geographic Information System. |
|
4 |
|
|
5 |
Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
|
8 |
modify it under the terms of the GNU General Public License |
|
9 |
as published by the Free Software Foundation; either version 3 |
|
10 |
of the License, or (at your option) any later version. |
|
11 |
|
|
12 |
This program is distributed in the hope that it will be useful, |
|
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
GNU General Public License for more details. |
|
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
|
18 |
along with this program; if not, write to the Free Software |
|
19 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
MA 02110-1301, USA. |
|
21 |
|
|
22 |
For any additional information, do not hesitate to contact us |
|
23 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
|
|
25 |
--> |
|
26 |
<assembly> |
|
27 |
<id>gvsig-plugin-package</id> |
|
28 |
<formats> |
|
29 |
<format>zip</format> |
|
30 |
</formats> |
|
31 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
32 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
33 |
<files> |
|
34 |
<file> |
|
35 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
36 |
<outputDirectory>lib</outputDirectory> |
|
37 |
</file> |
|
38 |
<file> |
|
39 |
<source>target/package.info</source> |
|
40 |
</file> |
|
41 |
</files> |
|
42 |
|
|
43 |
<fileSets> |
|
44 |
<fileSet> |
|
45 |
<directory>src/main/resources-plugin</directory> |
|
46 |
<outputDirectory>.</outputDirectory> |
|
47 |
</fileSet> |
|
48 |
</fileSets> |
|
49 |
|
|
50 |
<dependencySets> |
|
51 |
<dependencySet> |
|
52 |
<useProjectArtifact>false</useProjectArtifact> |
|
53 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
54 |
<outputDirectory>lib</outputDirectory> |
|
55 |
<includes> |
|
56 |
<include>bsf:bsf</include> |
|
57 |
<include>org.python:jython</include> |
|
58 |
<include>com.fifesoft:rsyntaxtextarea</include> |
|
59 |
</includes> |
|
60 |
</dependencySet> |
|
61 |
</dependencySets> |
|
62 |
|
|
63 |
</assembly> |
|
64 |
|
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/gui/FieldExpressionPage.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.gui; |
|
27 |
|
|
28 |
import java.awt.event.MouseEvent; |
|
29 |
import java.awt.event.MouseListener; |
|
30 |
import java.util.prefs.Preferences; |
|
31 |
|
|
32 |
import javax.swing.ImageIcon; |
|
33 |
import javax.swing.JCheckBox; |
|
34 |
import javax.swing.JPanel; |
|
35 |
import javax.swing.JTextArea; |
|
36 |
import javax.swing.JTextField; |
|
37 |
|
|
38 |
import org.gvsig.andami.IconThemeHelper; |
|
39 |
import org.gvsig.andami.PluginServices; |
|
40 |
import org.gvsig.andami.preferences.AbstractPreferencePage; |
|
41 |
import org.gvsig.andami.preferences.StoreException; |
|
42 |
|
|
43 |
|
|
44 |
/** |
|
45 |
* @author Vicente Caballero Navarro |
|
46 |
*/ |
|
47 |
public class FieldExpressionPage extends AbstractPreferencePage { |
|
48 |
private static Preferences prefs = Preferences.userRoot().node( "fieldExpressionOptions" ); |
|
49 |
private JTextArea jTextArea = null; |
|
50 |
private JTextField txtLimit; |
|
51 |
private JCheckBox ckLimit=null; |
|
52 |
private ImageIcon icon; |
|
53 |
|
|
54 |
public FieldExpressionPage() { |
|
55 |
super(); |
|
56 |
|
|
57 |
icon = IconThemeHelper.getImageIcon("expression-field-preferences"); |
|
58 |
|
|
59 |
addComponent(getJTextArea()); |
|
60 |
|
|
61 |
addComponent(PluginServices.getText(this, "limit_rows_in_memory") + ":", |
|
62 |
txtLimit = new JTextField("", 15)); |
|
63 |
addComponent(ckLimit = new JCheckBox(PluginServices.getText(this, "without_limit"))); |
|
64 |
ckLimit.addMouseListener(new MouseListener() { |
|
65 |
public void mouseClicked(MouseEvent e) { |
|
66 |
if (ckLimit.isSelected()) { |
|
67 |
txtLimit.setText(PluginServices.getText(this, "without_limit")); |
|
68 |
}else { |
|
69 |
if (txtLimit.getText().equals(PluginServices.getText(this, "without_limit"))) |
|
70 |
txtLimit.setText("500000"); |
|
71 |
} |
|
72 |
|
|
73 |
} |
|
74 |
public void mouseEntered(MouseEvent e) { |
|
75 |
} |
|
76 |
public void mouseExited(MouseEvent e) { |
|
77 |
} |
|
78 |
public void mousePressed(MouseEvent e) { |
|
79 |
} |
|
80 |
public void mouseReleased(MouseEvent e) { |
|
81 |
} |
|
82 |
|
|
83 |
}); |
|
84 |
} |
|
85 |
|
|
86 |
public void initializeValues() { |
|
87 |
int limit = prefs.getInt("limit_rows_in_memory",-1); |
|
88 |
if (limit==-1) { |
|
89 |
ckLimit.setSelected(true); |
|
90 |
txtLimit.setText(PluginServices.getText(this,"without_limit")); |
|
91 |
}else { |
|
92 |
ckLimit.setSelected(false); |
|
93 |
txtLimit.setText(String.valueOf(limit)); |
|
94 |
} |
|
95 |
} |
|
96 |
|
|
97 |
public String getID() { |
|
98 |
return this.getClass().getName(); |
|
99 |
} |
|
100 |
|
|
101 |
public String getTitle() { |
|
102 |
return PluginServices.getText(this, "limit_rows_in_memory"); |
|
103 |
} |
|
104 |
|
|
105 |
public JPanel getPanel() { |
|
106 |
return this; |
|
107 |
} |
|
108 |
|
|
109 |
public void storeValues() throws StoreException { |
|
110 |
int limit; |
|
111 |
try{ |
|
112 |
if (ckLimit.isSelected()) { |
|
113 |
limit=-1; |
|
114 |
}else { |
|
115 |
// if (txtLimit.getText().equals(PluginServices.getText(this,"without_limit"))) { |
|
116 |
// limit=-1; |
|
117 |
// }else { |
|
118 |
limit=Integer.parseInt(txtLimit.getText()); |
|
119 |
} |
|
120 |
}catch (Exception e) { |
|
121 |
throw new StoreException(PluginServices.getText(this,"limit_rows_in_memory")+PluginServices.getText(this,"error")); |
|
122 |
} |
|
123 |
prefs.putInt("limit_rows_in_memory", limit); |
|
124 |
} |
|
125 |
|
|
126 |
public void initializeDefaults() { |
|
127 |
int limit=prefs.getInt("limit_rows_in_memory",-1); |
|
128 |
if (limit==-1) { |
|
129 |
ckLimit.setSelected(true); |
|
130 |
txtLimit.setText(PluginServices.getText(this,"without_limit")); |
|
131 |
}else { |
|
132 |
ckLimit.setSelected(false); |
|
133 |
txtLimit.setText(String.valueOf(limit)); |
|
134 |
} |
|
135 |
} |
|
136 |
|
|
137 |
public ImageIcon getIcon() { |
|
138 |
return icon; |
|
139 |
} |
|
140 |
/** |
|
141 |
* This method initializes jTextArea |
|
142 |
* |
|
143 |
* @return javax.swing.JTextArea |
|
144 |
*/ |
|
145 |
private JTextArea getJTextArea() { |
|
146 |
if (jTextArea == null) { |
|
147 |
jTextArea = new JTextArea(); |
|
148 |
jTextArea.setBounds(new java.awt.Rectangle(13,7,285,57)); |
|
149 |
jTextArea.setForeground(java.awt.Color.black); |
|
150 |
jTextArea.setBackground(java.awt.SystemColor.control); |
|
151 |
jTextArea.setRows(3); |
|
152 |
jTextArea.setWrapStyleWord(true); |
|
153 |
jTextArea.setLineWrap(true); |
|
154 |
jTextArea.setEditable(false); |
|
155 |
jTextArea.setText(PluginServices.getText(this,"specifies_the_limit_rows_in_memory_when_the_program_eval_the_expression")); |
|
156 |
} |
|
157 |
return jTextArea; |
|
158 |
} |
|
159 |
|
|
160 |
public boolean isValueChanged() { |
|
161 |
return super.hasChanged(); |
|
162 |
} |
|
163 |
|
|
164 |
public void setChangesApplied() { |
|
165 |
setChanged(false); |
|
166 |
} |
|
167 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/GraphicOperator.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table; |
|
27 |
|
|
28 |
import java.awt.geom.PathIterator; |
|
29 |
import java.util.ArrayList; |
|
30 |
|
|
31 |
import org.gvsig.fmap.geom.Geometry; |
|
32 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
33 |
import org.gvsig.fmap.geom.GeometryManager; |
|
34 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
35 |
|
|
36 |
/** |
|
37 |
* @author Vicente Caballero Navarro |
|
38 |
*/ |
|
39 |
public abstract class GraphicOperator extends AbstractOperator{ |
|
40 |
private FLyrVect lv=null; |
|
41 |
private static GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
42 |
|
|
43 |
public void setLayer(FLyrVect lv) { |
|
44 |
this.lv=lv; |
|
45 |
} |
|
46 |
public FLyrVect getLayer() { |
|
47 |
return lv; |
|
48 |
} |
|
49 |
public abstract double process(org.gvsig.fmap.dal.feature.Feature feature); |
|
50 |
protected ArrayList getXY(Geometry geometry) { |
|
51 |
ArrayList xs = new ArrayList(); |
|
52 |
ArrayList ys = new ArrayList(); |
|
53 |
ArrayList parts=new ArrayList(); |
|
54 |
double[] theData = new double[6]; |
|
55 |
|
|
56 |
//double[] aux = new double[6]; |
|
57 |
PathIterator theIterator; |
|
58 |
int theType; |
|
59 |
int numParts = 0; |
|
60 |
theIterator = geometry.getPathIterator(null, geomManager.getFlatness()); //, flatness); |
|
61 |
boolean isClosed = false; |
|
62 |
while (!theIterator.isDone()) { |
|
63 |
theType = theIterator.currentSegment(theData); |
|
64 |
|
|
65 |
switch (theType) { |
|
66 |
case PathIterator.SEG_MOVETO: |
|
67 |
if (numParts==0){ |
|
68 |
xs.add(new Double(theData[0])); |
|
69 |
ys.add(new Double(theData[1])); |
|
70 |
}else{ |
|
71 |
if (!isClosed){ |
|
72 |
Double[] x = (Double[]) xs.toArray(new Double[0]); |
|
73 |
Double[] y = (Double[]) ys.toArray(new Double[0]); |
|
74 |
parts.add(new Double[][] { x, y }); |
|
75 |
xs.clear(); |
|
76 |
ys.clear(); |
|
77 |
} |
|
78 |
xs.add(new Double(theData[0])); |
|
79 |
ys.add(new Double(theData[1])); |
|
80 |
} |
|
81 |
numParts++; |
|
82 |
isClosed = false; |
|
83 |
break; |
|
84 |
case PathIterator.SEG_LINETO: |
|
85 |
isClosed=false; |
|
86 |
xs.add(new Double(theData[0])); |
|
87 |
ys.add(new Double(theData[1])); |
|
88 |
break; |
|
89 |
case PathIterator.SEG_CLOSE: |
|
90 |
isClosed=true; |
|
91 |
xs.add(new Double(theData[0])); |
|
92 |
ys.add(new Double(theData[1])); |
|
93 |
Double[] x = (Double[]) xs.toArray(new Double[0]); |
|
94 |
Double[] y = (Double[]) ys.toArray(new Double[0]); |
|
95 |
parts.add(new Double[][] { x, y }); |
|
96 |
xs.clear(); |
|
97 |
ys.clear(); |
|
98 |
break; |
|
99 |
} //end switch |
|
100 |
|
|
101 |
theIterator.next(); |
|
102 |
} //end while loop |
|
103 |
|
|
104 |
if (!isClosed){ |
|
105 |
isClosed=true; |
|
106 |
xs.add(new Double(theData[0])); |
|
107 |
ys.add(new Double(theData[1])); |
|
108 |
Double[] x = (Double[]) xs.toArray(new Double[0]); |
|
109 |
Double[] y = (Double[]) ys.toArray(new Double[0]); |
|
110 |
parts.add(new Double[][] { x, y }); |
|
111 |
xs.clear(); |
|
112 |
ys.clear(); |
|
113 |
} |
|
114 |
return parts; |
|
115 |
|
|
116 |
} |
|
117 |
|
|
118 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/ToLowerCase.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import org.apache.bsf.BSFException; |
|
29 |
import org.apache.bsf.BSFManager; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.expressionfield.ExpressionFieldExtension; |
|
32 |
import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
|
33 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* @author Vicente Caballero Navarro |
|
38 |
*/ |
|
39 |
public class ToLowerCase extends AbstractOperator{ |
|
40 |
|
|
41 |
public String addText(String s) { |
|
42 |
return toString()+"("+s+")"; |
|
43 |
} |
|
44 |
public String toString() { |
|
45 |
return "toLowerCase"; |
|
46 |
} |
|
47 |
public void eval(BSFManager interpreter) throws BSFException { |
|
48 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"String toLowerCase(String value){return value.toLowerCase();};"); |
|
49 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def toLowerCase(value):\n" + |
|
50 |
" return value.lower()"); |
|
51 |
} |
|
52 |
public boolean isEnable() { |
|
53 |
return (getType()==IOperator.STRING); |
|
54 |
} |
|
55 |
public String getDescription() { |
|
56 |
return PluginServices.getText(this, "parameter") + ": " + |
|
57 |
PluginServices.getText(this, "string_value") + "\n" + |
|
58 |
PluginServices.getText(this, "returns") + ": " + |
|
59 |
PluginServices.getText(this, "string_value") + "\n" + |
|
60 |
PluginServices.getText(this, "description") + ": " + |
|
61 |
"Converts all of the characters in this String to lower case using the rules of the default locale."; |
|
62 |
} |
|
63 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Round.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import org.apache.bsf.BSFException; |
|
29 |
import org.apache.bsf.BSFManager; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.expressionfield.ExpressionFieldExtension; |
|
32 |
import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
|
33 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* @author Vicente Caballero Navarro |
|
38 |
*/ |
|
39 |
public class Round extends AbstractOperator{ |
|
40 |
|
|
41 |
public String addText(String s) { |
|
42 |
return toString()+"("+s+")"; |
|
43 |
} |
|
44 |
public String toString() { |
|
45 |
return "round"; |
|
46 |
} |
|
47 |
public void eval(BSFManager interpreter) throws BSFException { |
|
48 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double round(double value){return java.lang.Math.round(value);};"); |
|
49 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def round(value):\n" + |
|
50 |
" import java.lang.Math\n" + |
|
51 |
" return java.lang.Math.round(value)"); |
|
52 |
} |
|
53 |
public boolean isEnable() { |
|
54 |
return (getType()==IOperator.NUMBER); |
|
55 |
} |
|
56 |
public String getDescription() { |
|
57 |
return PluginServices.getText(this, "parameter") + ": " + |
|
58 |
PluginServices.getText(this, "numeric_value") + "\n" + |
|
59 |
PluginServices.getText(this, "returns") + ": " + |
|
60 |
PluginServices.getText(this, "numeric_value") + "\n" + |
|
61 |
PluginServices.getText(this, "description") + ": " + |
|
62 |
"Returns the closest long to the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to type long."; |
|
63 |
} |
|
64 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/ToUpperCase.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import org.apache.bsf.BSFException; |
|
29 |
import org.apache.bsf.BSFManager; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.expressionfield.ExpressionFieldExtension; |
|
32 |
import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
|
33 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* @author Vicente Caballero Navarro |
|
38 |
*/ |
|
39 |
public class ToUpperCase extends AbstractOperator{ |
|
40 |
|
|
41 |
public String addText(String s) { |
|
42 |
return toString()+"("+s+")"; |
|
43 |
} |
|
44 |
public String toString() { |
|
45 |
return "toUpperCase"; |
|
46 |
} |
|
47 |
public void eval(BSFManager interpreter) throws BSFException { |
|
48 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"String toUpperCase(String value){return value.toUpperCase();};"); |
|
49 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def toUpperCase(value):\n" + |
|
50 |
" return value.upper()"); |
|
51 |
} |
|
52 |
public boolean isEnable() { |
|
53 |
return (getType()==IOperator.STRING); |
|
54 |
} |
|
55 |
public String getDescription() { |
|
56 |
return PluginServices.getText(this, "parameter") + ": " + |
|
57 |
PluginServices.getText(this, "string_value") + "\n" + |
|
58 |
PluginServices.getText(this, "returns") + ": " + |
|
59 |
PluginServices.getText(this, "string_value") + "\n" + |
|
60 |
PluginServices.getText(this, "description") + ": " + |
|
61 |
"Converts all of the characters in this String to upper case using the rules of the given Locale.\n" + |
|
62 |
"Case mappings rely heavily on the Unicode specification's character data.\n" + |
|
63 |
"Since case mappings are not always 1:1 char mappings, the resulting String may be a different length than the original String."; |
|
64 |
} |
|
65 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Asin.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import org.apache.bsf.BSFException; |
|
29 |
import org.apache.bsf.BSFManager; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.expressionfield.ExpressionFieldExtension; |
|
32 |
import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
|
33 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* @author Vicente Caballero Navarro |
|
38 |
*/ |
|
39 |
public class Asin extends AbstractOperator{ |
|
40 |
|
|
41 |
public String addText(String s) { |
|
42 |
return toString()+"("+s+")"; |
|
43 |
} |
|
44 |
public String toString() { |
|
45 |
return "asin"; |
|
46 |
} |
|
47 |
public void eval(BSFManager interpreter) throws BSFException { |
|
48 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double asin(double value){return java.lang.Math.asin(value);};"); |
|
49 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def asin(value):\n" + |
|
50 |
" import java.lang.Math\n" + |
|
51 |
" return java.lang.Math.asin(value)"); |
|
52 |
} |
|
53 |
public boolean isEnable() { |
|
54 |
return (getType()==IOperator.NUMBER); |
|
55 |
} |
|
56 |
public String getDescription() { |
|
57 |
return PluginServices.getText(this, "parameter") + ": " + |
|
58 |
PluginServices.getText(this, "numeric_value") + "\n" + |
|
59 |
PluginServices.getText(this, "returns") + ": " + |
|
60 |
PluginServices.getText(this, "numeric_value") + "\n" + |
|
61 |
PluginServices.getText(this, "description") + ": " + |
|
62 |
"Returns the arc sine of an angle, in the range of -pi/2 through pi/2. Special cases:\n" + |
|
63 |
"* If the argument is NaN or its absolute value is greater than 1, then the result is NaN.\n" + |
|
64 |
"* If the argument is zero, then the result is a zero with the same sign as the argument.\n"; |
|
65 |
} |
|
66 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Geometry.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import org.apache.bsf.BSFException; |
|
29 |
import org.apache.bsf.BSFManager; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.expressionfield.ExpressionFieldExtension; |
|
32 |
import org.gvsig.expressionfield.project.documents.table.GraphicOperator; |
|
33 |
import org.gvsig.fmap.dal.feature.Feature; |
|
34 |
|
|
35 |
/** |
|
36 |
* @author Vicente Caballero Navarro |
|
37 |
*/ |
|
38 |
public class Geometry extends GraphicOperator{ |
|
39 |
|
|
40 |
public String addText(String s) { |
|
41 |
return s.concat(toString()+"()"); |
|
42 |
} |
|
43 |
public double process(Feature feature) { |
|
44 |
return 0; |
|
45 |
} |
|
46 |
public org.gvsig.fmap.geom.Geometry getGeometry(Feature feature) { |
|
47 |
// ReadableVectorial adapter = getLayer().getSource(); |
|
48 |
org.gvsig.fmap.geom.Geometry geom=feature.getDefaultGeometry();//adapter.getShape(index.get()); |
|
49 |
return geom; |
|
50 |
} |
|
51 |
public void eval(BSFManager interpreter) throws BSFException { |
|
52 |
interpreter.declareBean("jgeometry",this,Geometry.class); |
|
53 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"java.lang.Object geometry(){return geometry.getGeometry(indexRow);};"); |
|
54 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def geometry():\n" + |
|
55 |
" return jgeometry.getGeometry(featureContainer.getFeature())"); |
|
56 |
} |
|
57 |
public String toString() { |
|
58 |
return "geometry"; |
|
59 |
} |
|
60 |
public boolean isEnable() { |
|
61 |
return false; |
|
62 |
} |
|
63 |
public String getTooltip(){ |
|
64 |
return PluginServices.getText(this,"operator")+": "+addText("")+"\n"+getDescription(); |
|
65 |
} |
|
66 |
public String getDescription() { |
|
67 |
return PluginServices.getText(this, "returns") + ": " + |
|
68 |
PluginServices.getText(this, "numeric_value") + "\n" + |
|
69 |
PluginServices.getText(this, "description") + ": " + |
|
70 |
"Returns the geometry of this row."; |
|
71 |
} |
|
72 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/ToNumber.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import org.apache.bsf.BSFException; |
|
29 |
import org.apache.bsf.BSFManager; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.expressionfield.ExpressionFieldExtension; |
|
32 |
import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
|
33 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* @author Vicente Caballero Navarro |
|
38 |
*/ |
|
39 |
public class ToNumber extends AbstractOperator{ |
|
40 |
|
|
41 |
public String addText(String s) { |
|
42 |
return toString()+"("+s+")"; |
|
43 |
} |
|
44 |
public String toString() { |
|
45 |
return "toNumber"; |
|
46 |
} |
|
47 |
public void eval(BSFManager interpreter) throws BSFException { |
|
48 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double toNumber(String value){return java.lang.Double.parseDouble(value);};"); |
|
49 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def toNumber(value):\n" + |
|
50 |
" import java.lang.Double\n" + |
|
51 |
" return java.lang.Double.parseDouble(value)"); |
|
52 |
} |
|
53 |
public boolean isEnable() { |
|
54 |
return (getType()==IOperator.NUMBER ); |
|
55 |
} |
|
56 |
public String getDescription() { |
|
57 |
return PluginServices.getText(this, "parameter") + ": " + |
|
58 |
PluginServices.getText(this, "string_value") + "\n" + |
|
59 |
PluginServices.getText(this, "returns") + ": " + |
|
60 |
PluginServices.getText(this, "double_value") + "\n" + |
|
61 |
PluginServices.getText(this, "description") + ": " + |
|
62 |
"Returns a new number initialized to the value represented by the specified String"; |
|
63 |
} |
|
64 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Before.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import org.apache.bsf.BSFException; |
|
29 |
import org.apache.bsf.BSFManager; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.expressionfield.ExpressionFieldExtension; |
|
32 |
import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
|
33 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* @author Vicente Caballero Navarro |
|
38 |
*/ |
|
39 |
public class Before extends AbstractOperator{ |
|
40 |
|
|
41 |
public String addText(String s) { |
|
42 |
return toString()+"("+s+",)"; |
|
43 |
} |
|
44 |
public String toString() { |
|
45 |
return "before"; |
|
46 |
} |
|
47 |
public void eval(BSFManager interpreter) throws BSFException { |
|
48 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"boolean before(java.lang.Object value1,java.lang.Object value2){return value1.before(value2);};"); |
|
49 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def before(value1, value2):\n" + |
|
50 |
" return value1.before(value2)"); |
|
51 |
} |
|
52 |
public boolean isEnable() { |
|
53 |
return (getType()==IOperator.DATE); |
|
54 |
} |
|
55 |
public String getTooltip(){ |
|
56 |
return PluginServices.getText(this,"operator")+": "+toString()+"("+PluginServices.getText(this,"parameter")+"1,"+PluginServices.getText(this,"parameter")+"2"+")"+"\n"+getDescription(); |
|
57 |
} |
|
58 |
public String getDescription() { |
|
59 |
return PluginServices.getText(this, "parameter") + "1"+": " + |
|
60 |
PluginServices.getText(this, "date_value") + "\n"+ |
|
61 |
PluginServices.getText(this, "parameter") + "2"+": " + |
|
62 |
PluginServices.getText(this, "date_value") + "\n"+ |
|
63 |
PluginServices.getText(this, "returns") + ": " + |
|
64 |
PluginServices.getText(this, "boolean_value") + "\n" + |
|
65 |
PluginServices.getText(this, "description") + ": " + |
|
66 |
"Tests if parameter1 date is before the parameter2 date."; |
|
67 |
} |
|
68 |
|
|
69 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Equal.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import org.apache.bsf.BSFException; |
|
29 |
import org.apache.bsf.BSFManager; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
|
32 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
|
33 |
|
|
34 |
|
|
35 |
/** |
|
36 |
* @author Vicente Caballero Navarro |
|
37 |
*/ |
|
38 |
public class Equal extends AbstractOperator{ |
|
39 |
|
|
40 |
public String addText(String s) { |
|
41 |
return s.concat(toString()); |
|
42 |
} |
|
43 |
|
|
44 |
public void eval(BSFManager interpreter) throws BSFException { |
|
45 |
|
|
46 |
} |
|
47 |
public String toString() { |
|
48 |
return " == "; |
|
49 |
} |
|
50 |
public boolean isEnable() { |
|
51 |
return (getType()==IOperator.DATE || getType()==IOperator.NUMBER || getType()==IOperator.STRING); |
|
52 |
} |
|
53 |
public String getTooltip(){ |
|
54 |
return PluginServices.getText(this,"operator")+": "+addText("")+"\n"+getDescription(); |
|
55 |
} |
|
56 |
public String getDescription() { |
|
57 |
return PluginServices.getText(this, "returns") + ": " + |
|
58 |
PluginServices.getText(this, "boolean_value") + "\n" + |
|
59 |
PluginServices.getText(this, "description") + ": " + |
|
60 |
"Returns true if the first object value is equals than the second value."; |
|
61 |
} |
|
62 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Trim.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import org.apache.bsf.BSFException; |
|
29 |
import org.apache.bsf.BSFManager; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.expressionfield.ExpressionFieldExtension; |
|
32 |
import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
|
33 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* @author Vicente Caballero Navarro |
|
38 |
*/ |
|
39 |
public class Trim extends AbstractOperator{ |
|
40 |
|
|
41 |
public String addText(String s) { |
|
42 |
return toString()+"("+s+")"; |
|
43 |
} |
|
44 |
public String toString() { |
|
45 |
return "trim"; |
|
46 |
} |
|
47 |
public void eval(BSFManager interpreter) throws BSFException { |
|
48 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"String trim(String value){return value.trim();};"); |
|
49 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def trim(value):\n" + |
|
50 |
" return value.strip()"); |
|
51 |
} |
|
52 |
public boolean isEnable() { |
|
53 |
return (getType()==IOperator.STRING); |
|
54 |
} |
|
55 |
public String getDescription() { |
|
56 |
return PluginServices.getText(this, "parameter") + ": " + |
|
57 |
PluginServices.getText(this, "string_value") + "\n" + |
|
58 |
PluginServices.getText(this, "returns") + ": " + |
|
59 |
PluginServices.getText(this, "string_value") + "\n" + |
|
60 |
PluginServices.getText(this, "description") + ": " + |
|
61 |
"Returns a copy of the string, with leading and trailing whitespace omitted."; |
|
62 |
} |
|
63 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Replace.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import org.apache.bsf.BSFException; |
|
29 |
import org.apache.bsf.BSFManager; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.expressionfield.ExpressionFieldExtension; |
|
32 |
import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
|
33 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* @author Vicente Caballero Navarro |
|
38 |
*/ |
|
39 |
public class Replace extends AbstractOperator{ |
|
40 |
|
|
41 |
public String addText(String s) { |
|
42 |
return toString()+"("+s+" , \"\",\"\")"; |
|
43 |
} |
|
44 |
public String toString() { |
|
45 |
return "replace"; |
|
46 |
} |
|
47 |
public void eval(BSFManager interpreter) throws BSFException { |
|
48 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"String replace(String value1,String value2,String value3){return value1.replaceAll(value2,value3);};"); |
|
49 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def replace(value1,value2,value3):\n" + |
|
50 |
" return value1.replace(value2,value3)"); |
|
51 |
} |
|
52 |
public boolean isEnable() { |
|
53 |
return (getType()==IOperator.STRING); |
|
54 |
} |
|
55 |
public String getTooltip(){ |
|
56 |
return PluginServices.getText(this,"operator")+": "+toString()+"("+PluginServices.getText(this,"parameter")+"1,"+PluginServices.getText(this,"parameter")+"2, "+PluginServices.getText(this,"parameter")+"3"+")"+"\n"+getDescription(); |
|
57 |
} |
|
58 |
public String getDescription() { |
|
59 |
return PluginServices.getText(this, "parameter") + "1"+": " + |
|
60 |
PluginServices.getText(this, "string_value") + "\n"+ |
|
61 |
PluginServices.getText(this, "parameter") + "2"+": " + |
|
62 |
PluginServices.getText(this, "string_value") + "\n"+ |
|
63 |
PluginServices.getText(this, "parameter") + "3"+": " + |
|
64 |
PluginServices.getText(this, "string_value") + "\n"+ |
|
65 |
PluginServices.getText(this, "returns") + ": " + |
|
66 |
PluginServices.getText(this, "string_value") + "\n" + |
|
67 |
PluginServices.getText(this, "description") + ": " + |
|
68 |
"Replaces each substring(parameter2) of parameter1 string that matches the given regular expression with the given replacement parameter3"; |
|
69 |
} |
|
70 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/LastIndexOf.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import org.apache.bsf.BSFException; |
|
29 |
import org.apache.bsf.BSFManager; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.expressionfield.ExpressionFieldExtension; |
|
32 |
import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
|
33 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* @author Vicente Caballero Navarro |
|
38 |
*/ |
|
39 |
public class LastIndexOf extends AbstractOperator{ |
|
40 |
|
|
41 |
public String addText(String s) { |
|
42 |
return toString()+"("+s+", \"\")"; |
|
43 |
} |
|
44 |
public String toString() { |
|
45 |
return "lastIndexOf"; |
|
46 |
} |
|
47 |
public void eval(BSFManager interpreter) throws BSFException { |
|
48 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"int lastIndexOf(String value1,String value2){return value1.lastIndexOf(value2);};"); |
|
49 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def lastIndexOf(value1,value2):\n" + |
|
50 |
" return value1.rfind(value2)"); |
|
51 |
} |
|
52 |
public boolean isEnable() { |
|
53 |
return (getType()==IOperator.STRING); |
|
54 |
} |
|
55 |
public String getTooltip(){ |
|
56 |
return PluginServices.getText(this,"operator")+": "+toString()+"("+PluginServices.getText(this,"parameter")+"1,"+PluginServices.getText(this,"parameter")+"2"+")"+"\n"+getDescription(); |
|
57 |
} |
|
58 |
public String getDescription() { |
|
59 |
return PluginServices.getText(this, "parameter") + "1"+": " + |
|
60 |
PluginServices.getText(this, "string_value") + "\n"+ |
|
61 |
PluginServices.getText(this, "parameter") + "2"+": " + |
|
62 |
PluginServices.getText(this, "string_value") + "\n"+ |
|
63 |
PluginServices.getText(this, "returns") + ": " + |
|
64 |
PluginServices.getText(this, "boolean_value") + "\n" + |
|
65 |
PluginServices.getText(this, "description") + ": " + |
|
66 |
"Returns the index within parameter1 of the last occurrence of the parameter2 character."; |
|
67 |
} |
|
68 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/SubString.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import org.apache.bsf.BSFException; |
|
29 |
import org.apache.bsf.BSFManager; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.expressionfield.ExpressionFieldExtension; |
|
32 |
import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
|
33 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* @author Vicente Caballero Navarro |
|
38 |
*/ |
|
39 |
public class SubString extends AbstractOperator{ |
|
40 |
|
|
41 |
public String addText(String s) { |
|
42 |
return toString()+"("+s+",,)"; |
|
43 |
} |
|
44 |
public String toString() { |
|
45 |
return "subString"; |
|
46 |
} |
|
47 |
public void eval(BSFManager interpreter) throws BSFException { |
|
48 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"String subString(String value1,int value2,int value3){return value1.substring(value2,value3);};"); |
|
49 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def subString(value1,value2,value3):\n" + |
|
50 |
" return value1[value2:value3]"); |
|
51 |
} |
|
52 |
public boolean isEnable() { |
|
53 |
return (getType()==IOperator.STRING); |
|
54 |
} |
|
55 |
public String getTooltip(){ |
|
56 |
return PluginServices.getText(this,"operator")+": "+toString()+"("+PluginServices.getText(this,"parameter")+"1,"+PluginServices.getText(this,"parameter")+"2, "+PluginServices.getText(this,"parameter")+"3"+")"+"\n"+getDescription(); |
|
57 |
} |
|
58 |
public String getDescription() { |
|
59 |
return PluginServices.getText(this, "parameter") + "1"+": " + |
|
60 |
PluginServices.getText(this, "string_value") + "\n"+ |
|
61 |
PluginServices.getText(this, "parameter") + "2"+": " + |
|
62 |
PluginServices.getText(this, "numeric_value") + "\n"+ |
|
63 |
PluginServices.getText(this, "parameter") + "3"+": " + |
|
64 |
PluginServices.getText(this, "numeric_value") + "\n"+ |
|
65 |
PluginServices.getText(this, "returns") + ": " + |
|
66 |
PluginServices.getText(this, "string_value") + "\n" + |
|
67 |
PluginServices.getText(this, "description") + ": " + |
|
68 |
"Returns a new string that is a substring of parameter1.\n" + |
|
69 |
"The substring begins at the specified parameter2 and extends to the character at index parameter3 - 1.\n" + |
|
70 |
"Thus the length of the substring is endIndex-beginIndex."; |
|
71 |
} |
|
72 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/PointX.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import java.util.ArrayList; |
|
29 |
|
|
30 |
import org.apache.bsf.BSFException; |
|
31 |
import org.apache.bsf.BSFManager; |
|
32 |
import org.gvsig.andami.PluginServices; |
|
33 |
import org.gvsig.andami.messages.NotificationManager; |
|
34 |
import org.gvsig.expressionfield.ExpressionFieldExtension; |
|
35 |
import org.gvsig.expressionfield.project.documents.table.GraphicOperator; |
|
36 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
|
37 |
import org.gvsig.fmap.dal.exception.DataException; |
|
38 |
import org.gvsig.fmap.dal.feature.Feature; |
|
39 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
40 |
|
|
41 |
/** |
|
42 |
* @author Vicente Caballero Navarro |
|
43 |
*/ |
|
44 |
public class PointX extends GraphicOperator{ |
|
45 |
|
|
46 |
public String addText(String s) { |
|
47 |
return s.concat(toString()+"()"); |
|
48 |
} |
|
49 |
public double process(Feature feature){ |
|
50 |
// ReadableVectorial adapter = getLayer().getSource(); |
|
51 |
org.gvsig.fmap.geom.Geometry geom=null; |
|
52 |
// try { |
|
53 |
geom = feature.getDefaultGeometry();//adapter.getShape(index.get()); |
|
54 |
// } catch (ExpansionFileReadException e) { |
|
55 |
// throw new DriverIOException(e); |
|
56 |
// } catch (ReadDriverException e) { |
|
57 |
// throw new DriverIOException(e); |
|
58 |
// } |
|
59 |
ArrayList parts=getXY(geom); |
|
60 |
Double[][] xsys=(Double[][])parts.get(0);//getXY(geom); |
|
61 |
return xsys[0][0].doubleValue(); |
|
62 |
} |
|
63 |
public void eval(BSFManager interpreter) throws BSFException { |
|
64 |
interpreter.declareBean("pointX",this,PointX.class); |
|
65 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double x(){return pointX.process(indexRow);};"); |
|
66 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def x():\n" + |
|
67 |
" return pointX.process(featureContainer.getFeature())"); |
|
68 |
} |
|
69 |
public String toString() { |
|
70 |
return "x"; |
|
71 |
} |
|
72 |
public boolean isEnable() { |
|
73 |
if (getLayer()==null) |
|
74 |
return false; |
|
75 |
int geomType=org.gvsig.fmap.geom.Geometry.TYPES.POINT; |
|
76 |
try { |
|
77 |
FeatureStore store = getLayer().getFeatureStore(); |
|
78 |
geomType = store.getDefaultFeatureType().getAttributeDescriptor(store.getDefaultFeatureType().getDefaultGeometryAttributeIndex()).getGeometryType(); |
|
79 |
} catch (DataException e) { |
|
80 |
NotificationManager.addError(e); |
|
81 |
} |
|
82 |
return (getType()==IOperator.NUMBER && geomType==org.gvsig.fmap.geom.Geometry.TYPES.POINT); |
|
83 |
} |
|
84 |
public String getTooltip(){ |
|
85 |
return PluginServices.getText(this,"operator")+": "+addText("")+"\n"+getDescription(); |
|
86 |
} |
|
87 |
public String getDescription() { |
|
88 |
return PluginServices.getText(this, "returns") + ": " + |
|
89 |
PluginServices.getText(this, "numeric_value") + "\n" + |
|
90 |
PluginServices.getText(this, "description") + ": " + |
|
91 |
"Returns the X coordenate of point geometry of this row."; |
|
92 |
} |
|
93 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Log.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import org.apache.bsf.BSFException; |
|
29 |
import org.apache.bsf.BSFManager; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.expressionfield.ExpressionFieldExtension; |
|
32 |
import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
|
33 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* @author Vicente Caballero Navarro |
|
38 |
*/ |
|
39 |
public class Log extends AbstractOperator{ |
|
40 |
|
|
41 |
public String addText(String s) { |
|
42 |
return toString()+"("+s+")"; |
|
43 |
} |
|
44 |
public String toString() { |
|
45 |
return "log"; |
|
46 |
} |
|
47 |
public void eval(BSFManager interpreter) throws BSFException { |
|
48 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double log(double value){return java.lang.Math.log(value);};"); |
|
49 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def log(value):\n" + |
|
50 |
" import java.lang.Math\n" + |
|
51 |
" return java.lang.Math.log(value)"); |
|
52 |
} |
|
53 |
public boolean isEnable() { |
|
54 |
return (getType()==IOperator.NUMBER); |
|
55 |
} |
|
56 |
public String getDescription() { |
|
57 |
return PluginServices.getText(this, "parameter") + ": " + |
|
58 |
PluginServices.getText(this, "numeric_value") + "\n" + |
|
59 |
PluginServices.getText(this, "returns") + ": " + |
|
60 |
PluginServices.getText(this, "numeric_value") + "\n" + |
|
61 |
PluginServices.getText(this, "description") + ": " + |
|
62 |
"Returns the natural logarithm (base e) of a double value. Special cases:\n" + |
|
63 |
"* If the argument is NaN or less than zero, then the result is NaN.\n" + |
|
64 |
"* If the argument is positive infinity, then the result is positive infinity.\n" + |
|
65 |
"* If the argument is positive zero or negative zero, then the result is negative infinity."; |
|
66 |
} |
|
67 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Times.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us |
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
* |
|
25 |
*******************************************************************************/ |
|
26 |
package org.gvsig.expressionfield.project.documents.table.operators; |
|
27 |
|
|
28 |
import org.apache.bsf.BSFException; |
|
29 |
import org.apache.bsf.BSFManager; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
|
32 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
|
33 |
|
|
34 |
|
|
35 |
/** |
|
36 |
* @author Vicente Caballero Navarro |
|
37 |
*/ |
|
38 |
public class Times extends AbstractOperator{ |
|
39 |
|
|
40 |
public String addText(String s) { |
|
41 |
return s.concat(toString()); |
|
42 |
} |
|
43 |
|
|
44 |
public void eval(BSFManager interpreter) throws BSFException { |
|
45 |
} |
|
46 |
public String toString() { |
|
47 |
return "*"; |
|
48 |
} |
|
49 |
public boolean isEnable() { |
|
50 |
return (getType()==IOperator.NUMBER); |
|
51 |
} |
|
52 |
public String getTooltip(){ |
|
53 |
return PluginServices.getText(this,"operator")+": "+addText("")+"\n"+getDescription(); |
|
54 |
} |
|
55 |
public String getDescription() { |
|
56 |
return PluginServices.getText(this, "returns") + ": " + |
|
57 |
PluginServices.getText(this, "numeric_value") + "\n" + |
|
58 |
PluginServices.getText(this, "description") + ": " + |
|
59 |
"Returns the result of times."; |
|
60 |
} |
|
61 |
} |
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.15/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Plus.java | ||
---|---|---|
1 |
/******************************************************************************* |
|
2 |
* |
|
3 |
* gvSIG. Desktop Geographic Information System. |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 3 |
Also available in: Unified diff