Revision 728

View differences:

org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/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.138/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
	protected static final 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
}
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Pi.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 Pi extends AbstractOperator{
40

  
41
	public String addText(String s) {
42
		return s.concat(toString()+"()");
43
	}
44
	public String toString() {
45
		return "pi";
46
	}
47
	public void eval(BSFManager interpreter) throws BSFException {
48
//		interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double pi(){return java.lang.Math.PI;};");
49
		interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def pi():\n" +
50
				"  import java.lang.Math\n" +
51
				"  return java.lang.Math.PI");
52
	}
53
	public boolean isEnable() {
54
		return (getType()==IOperator.NUMBER);
55
	}
56
	public String getTooltip(){
57
		return PluginServices.getText(this,"operator")+":  "+addText("")+"\n"+getDescription();
58
	}
59
	public String getDescription() {
60
        return PluginServices.getText(this, "returns") + ": " +
61
        PluginServices.getText(this, "numeric_value") + "\n" +
62
        PluginServices.getText(this, "description") + ": " +
63
        "The double value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter.";
64
    }
65
}
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Area.java
1
/**
2
 * *****************************************************************************
3
 *
4
 * gvSIG. Desktop Geographic Information System.
5
 *
6
 * Copyright (C) 2007-2013 gvSIG Association.
7
 *
8
 * This program is free software; you can redistribute it and/or modify it under
9
 * the terms of the GNU General Public License as published by the Free Software
10
 * Foundation; either version 3 of the License, or (at your option) any later
11
 * version.
12
 *
13
 * This program is distributed in the hope that it will be useful, but WITHOUT
14
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16
 * details.
17
 *
18
 * You should have received a copy of the GNU General Public License along with
19
 * this program; if not, write to the Free Software Foundation, Inc., 51
20
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
 *
22
 * For any additional information, do not hesitate to contact us at info AT
23
 * gvsig.com, or visit our website www.gvsig.com.
24
 *
25
 ******************************************************************************
26
 */
27
package org.gvsig.expressionfield.project.documents.table.operators;
28

  
29

  
30
import org.apache.bsf.BSFException;
31
import org.apache.bsf.BSFManager;
32
import org.cresques.cts.IProjection;
33
import org.gvsig.andami.PluginServices;
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.FeatureStore;
39
import org.gvsig.fmap.geom.Geometry;
40

  
41
import org.gvsig.fmap.mapcontext.MapContext;
42
import org.gvsig.fmap.mapcontrol.MapControlLocator;
43
import org.slf4j.Logger;
44
import org.slf4j.LoggerFactory;
45

  
46
public class Area extends GraphicOperator {
47

  
48
    private static final Logger logger = LoggerFactory.getLogger(Area.class);
49
    
50
    @Override
51
    public String addText(String s) {
52
        return s.concat(toString() + "()");
53
    }
54

  
55
    @Override
56
    public double process(org.gvsig.fmap.dal.feature.Feature feature) {
57
        org.gvsig.fmap.geom.Geometry geom;
58
        geom = feature.getDefaultGeometry();
59
        MapContext mapContext = getLayer().getMapContext();
60
        IProjection proj = mapContext.getProjection();
61
        int areaUnits = mapContext.getViewPort().getDistanceArea();
62
        return MapControlLocator.getMapControlManager().area(geom, proj, areaUnits);
63
    }
64

  
65
    @Override
66
    public void eval(BSFManager interpreter) throws BSFException {
67
        interpreter.declareBean("jarea", this, Area.class);
68
//		interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double area(){return area.process(indexRow);};");
69
        interpreter.exec(ExpressionFieldExtension.JYTHON, null, -1, -1, "def area():\n"
70
                + "  return jarea.process(featureContainer.getFeature())");
71
    }
72

  
73
    @Override
74
    public String toString() {
75
        return "area";
76
    }
77

  
78
    @Override
79
    public boolean isEnable() {
80
        if (getLayer() == null) {
81
            return false;
82
        }
83
        FeatureStore store;
84
        int geomType = Geometry.TYPES.POINT;
85
        try {
86
            store = getLayer().getFeatureStore();
87
            geomType = store.getDefaultFeatureType().getDefaultGeometryAttribute().getGeomType().getType();
88
        } catch (DataException e) {
89
            logger.warn("Can't get geometry type for default geometry attribute of layer '"+getLayer().getName()+"'.",e);
90
        }
91
//        GeometryManager geomManager = GeometryLocator.getGeometryManager();
92
        
93
        return getType() == IOperator.NUMBER && (
94
            geomManager.isSubtype(Geometry.TYPES.SURFACE, geomType) ||
95
            geomManager.isSubtype(Geometry.TYPES.MULTISURFACE, geomType) 
96
        );
97
    }
98

  
99
    @Override
100
    public String getTooltip() {
101
        return PluginServices.getText(this, "operator") + ":  " + addText("") + "\n" + getDescription();
102
    }
103

  
104
    @Override
105
    public String getDescription() {
106
        return PluginServices.getText(this, "returns") + ": "
107
                + PluginServices.getText(this, "numeric_value") + "\n"
108
                + PluginServices.getText(this, "description") + ": "
109
                + "Returns the area of polygon geometry of this row in the units of the view.";
110
    }
111
}
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/ToString.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 ToString extends AbstractOperator{
40

  
41
	public String addText(String s) {
42
		return toString()+"("+s+")";
43
	}
44
	public String toString() {
45
		return "toString";
46
	}
47
	public void eval(BSFManager interpreter) throws BSFException {
48
//		interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"String toString(java.lang.Object value){" +
49
//				"if (value instanceof java.util.Date)" +
50
//					"return ((java.util.Date)value).toString();" +
51
//				"return String.valueOf(value);};");
52
		interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def toString(value):\n" +
53
				"  return str(value)");
54
	}
55
	public boolean isEnable() {
56
		return (getType()==IOperator.NUMBER);// || getType()==IOperator.DATE);
57
	}
58
	public String getDescription() {
59
	    return PluginServices.getText(this, "parameter") + ": " +
60
	    PluginServices.getText(this, "value") + "\n" +
61
	    PluginServices.getText(this, "returns") + ": " +
62
	    PluginServices.getText(this, "string_value") + "\n" +
63
	    PluginServices.getText(this, "description") + ": " +
64
	    "Returns the string representation of the Object argument";
65
	}
66
}
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/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.138/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/StartsWith.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 StartsWith extends AbstractOperator{
40

  
41
	public String addText(String s) {
42
		return toString()+"("+s+",\"\")";
43
	}
44
	public String toString() {
45
		return "startsWith";
46
	}
47
	public void eval(BSFManager interpreter) throws BSFException {
48
//		interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"boolean startsWith(String value1,String value2){return value1.startsWith(value2);};");
49
		interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def startsWith(value1,value2):\n" +
50
				" return value1.startswith(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
        "Tests if this parameter1 starts with the specified parameter2.";
67
    }
68
}
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Ceil.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 Ceil extends AbstractOperator{
40

  
41
	public String addText(String s) {
42
		return toString()+"("+s+")";
43
	}
44
	public String toString() {
45
		return "ceil";
46
	}
47
	public void eval(BSFManager interpreter) throws BSFException {
48
//		interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double ceil(double value){return java.lang.Math.ceil(value);};");
49
		interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def ceil(value):\n" +
50
				"  import java.lang.Math\n" +
51
				"  return java.lang.Math.ceil(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 smallest (closest to negative infinity) double value that is not less than the argument and is equal to a mathematical integer. Special cases:\n" +
63
        "* If the argument value is already equal to a mathematical integer, then the result is the same as the argument.\n" +
64
        "* If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.\n" +
65
        "* If the argument value is less than zero but greater than -1.0, then the result is negative zero.\n";
66
    }
67

  
68
}
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/MoreEquals.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 MoreEquals 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, "boolean_value") + "\n" +
58
        PluginServices.getText(this, "description") + ": " +
59
        "Returns true if the first object value is more or equals than the second value.";
60
    }
61
}
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/MoreThan.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 MoreThan extends AbstractOperator{
39

  
40
	public String addText(String s) {
41
		return s.concat(toString());
42
	}
43
	public void eval(BSFManager interpreter) throws BSFException {
44

  
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, "boolean_value") + "\n" +
58
        PluginServices.getText(this, "description") + ": " +
59
        "Returns true if the first object value is more than the second value.";
60
    }
61
}
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/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.138/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Random.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 Random extends AbstractOperator{
40

  
41
	public String addText(String s) {
42
		return s.concat(toString()+"()");
43
	}
44
	public String toString() {
45
		return "random";
46
	}
47
	public void eval(BSFManager interpreter) throws BSFException {
48
//		interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double random(){return java.lang.Math.random();};");
49
		interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def random():\n" +
50
				"  import java.lang.Math\n" +
51
				"  return java.lang.Math.random()");
52
	}
53
	public boolean isEnable() {
54
		return (getType()==IOperator.NUMBER);
55
	}
56
	public String getTooltip(){
57
		return PluginServices.getText(this,"operator")+":  "+addText("")+"\n"+getDescription();
58
	}
59
	public String getDescription() {
60
        return PluginServices.getText(this, "returns") + ": " +
61
        PluginServices.getText(this, "numeric_value") + "\n" +
62
        PluginServices.getText(this, "description") + ": " +
63
        "Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. Returned values are chosen pseudorandomly with (approximately) uniform distribution from that range.";
64
    }
65
}
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/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.138/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/ToDate.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 ToDate extends AbstractOperator{
40

  
41
	public String addText(String s) {
42
		return toString()+"("+s+")";
43
	}
44
	public String toString() {
45
		return "toDate";
46
	}
47
	public void eval(BSFManager interpreter) throws BSFException {
48
//		interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"java.util.Date toDate(String value){return new java.text.SimpleDateFormat().parse(value);};");
49
		interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,
50
				"import java.text.DateFormat as DateFormat\n" +
51
				"import java.text.SimpleDateFormat as SimpleDateFormat\n" +
52
				"dateFormat = DateFormat.getInstance()\n" +
53
				"myDateFormat = SimpleDateFormat()\n" +
54
				"def toDate(value, format=None):\n" +
55
				"  if format != None:\n"+
56
				"    myDateFormat.applyPattern(format)\n"+
57
				"    return myDateFormat.parse(value)\n"+
58
				"  return dateFormat.parse(value)");
59
	}
60
	public boolean isEnable() {
61
		return (getType()==IOperator.DATE);
62
	}
63

  
64
	public String getTooltip(){
65
		return PluginServices.getText(this,"operator")+":  "+toString()+"("+PluginServices.getText(this,"parameter")+"[,"+PluginServices.getText(this,"format")+"])"+"\n"+getDescription();
66
	}
67

  
68
	public String getDescription() {
69
		return PluginServices.getText(this, "parameter") + "1: " +
70
	    PluginServices.getText(this, "string_value") + "\n" +
71
		PluginServices.getText(this, "format") + " ("+PluginServices.getText(this, "optional")+"): " +
72
	    PluginServices.getText(this, "string_value") + "\n" +
73
	    PluginServices.getText(this, "returns") + ": " +
74
	    PluginServices.getText(this, "date_value") + "\n" +
75
	    PluginServices.getText(this, "description") + ": " +
76
	    "Returns a date object from string parameter formatted according to\nthe parameter format if it is supplied.\n\n"+
77
	    "The format should follow the specifications of\n" +
78
	    "'http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html'.\n\n"+
79
	    "Examples: (for the date of December 23, 2008)\n"+
80
	    "  'dd/MM/yy'  23/12/08\n"+
81
	    "  'dd/MM/yyyy'  23/12/2008\n"+
82
	    "  'dd/MMM/yyyy'  23/dec/2008\n"+
83
	    "  'dd/MMMM/yyyy'  23/december/2008\n";
84

  
85
	}
86
}
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/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.138/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/LessThan.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 LessThan 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, "boolean_value") + "\n" +
58
        PluginServices.getText(this, "description") + ": " +
59
        "Returns true if the first object value is less than the second value.";
60
    }
61
}
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/LessEquals.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 LessEquals 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, "boolean_value") + "\n" +
58
        PluginServices.getText(this, "description") + ": " +
59
        "Returns true if the first object value is less or equals than the second value.";
60
    }
61
}
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Length.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 Length extends AbstractOperator{
40

  
41
	public String addText(String s) {
42
		return toString()+"("+s+")";
43
	}
44
	public String toString() {
45
		return "length";
46
	}
47
	public void eval(BSFManager interpreter) throws BSFException {
48
//		interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"int length(String value){return value.length();};");
49
		interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def length(value):\n" +
50
				"  return len(value)");
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, "numeric_value") + "\n" +
60
	    PluginServices.getText(this, "description") + ": " +
61
	    "Returns the length of string parameter.";
62
	}
63
}
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/Distinct.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 Distinct extends AbstractOperator{
39

  
40
	public String addText(String s) {
41
		return s.concat(toString());
42
	}
43
	public void eval(BSFManager interpreter) throws BSFException {
44
	}
45
	public String toString() {
46
		return "<>";
47
	}
48
	public boolean isEnable() {
49
		return (getType()==IOperator.DATE || getType()==IOperator.NUMBER || getType()==IOperator.STRING);
50
	}
51
	public String getTooltip(){
52
		return PluginServices.getText(this,"operator")+":  "+addText("")+"\n"+getDescription();
53
	}
54
	public String getDescription() {
55
        return PluginServices.getText(this, "returns") + ": " +
56
        PluginServices.getText(this, "boolean_value") + "\n" +
57
        PluginServices.getText(this, "description") + ": " +
58
        "Returns true if the objects are diferents.";
59
    }
60
}
org.gvsig.expressionfield/tags/org.gvsig.expressionfield-2.0.138/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.138/src/main/java/org/gvsig/expressionfield/project/documents/table/operators/PointY.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
import org.gvsig.fmap.geom.aggregate.Aggregate;
41
import org.gvsig.fmap.geom.primitive.OrientablePrimitive;
42
import org.gvsig.fmap.geom.primitive.Point;
43

  
44
/**
45
 * @author Vicente Caballero Navarro
46
 */
47
public class PointY extends GraphicOperator{
48

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff