Revision 46156

View differences:

tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.buildtools/src/main/resources/gvsig/checkstyle.xml
1
<?xml version="1.0"?>
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
9
    modify it under the terms of the GNU General Public License
10
    as published by the Free Software Foundation; either version 3
11
    of the License, or (at your option) any later version.
12

  
13
    This program is distributed in the hope that it will be useful,
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
    GNU General Public License for more details.
17

  
18
    You should have received a copy of the GNU General Public License
19
    along with this program; if not, write to the Free Software
20
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
    MA  02110-1301, USA.
22

  
23
    For any additional information, do not hesitate to contact us
24
    at info AT gvsig.com, or visit our website www.gvsig.com.
25

  
26
-->
27
<!DOCTYPE module PUBLIC
28
    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
29
    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
30

  
31
<!--
32

  
33
  Checkstyle configuration that checks the sun coding conventions from:
34

  
35
    - the Java Language Specification at
36
      http://java.sun.com/docs/books/jls/second_edition/html/index.html
37

  
38
    - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
39

  
40
    - the Javadoc guidelines at
41
      http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
42

  
43
    - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
44

  
45
    - some best practices
46

  
47
  Checkstyle is very configurable. Be sure to read the documentation at
48
  http://checkstyle.sf.net (or in your downloaded distribution).
49

  
50
  Most Checks are configurable, be sure to consult the documentation.
51

  
52
  To completely disable a check, just comment it out or delete it from the file.
53

  
54
  Finally, it is worth reading the documentation.
55

  
56
-->
57

  
58
<module name="Checker">
59
    <!--
60
        If you set the basedir property below, then all reported file
61
        names will be relative to the specified directory. See
62
        http://checkstyle.sourceforge.net/5.x/config.html#Checker
63

  
64
        <property name="basedir" value="${basedir}"/>
65
    -->
66
    <!-- gvSIG: All project files have the ISO-8859-1 charset -->
67
	<property name="charset" value="ISO-8859-1" />
68

  
69
    <!-- Checks that a package-info.java file exists for each package.     -->
70
    <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
71
	<module name="JavadocPackage">
72
		<property name="allowLegacy" value="true" />
73
	</module>
74

  
75
    <!-- Checks whether files end with a new line.                        -->
76
    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
77
    <module name="NewlineAtEndOfFile"/>
78

  
79
    <!-- Checks that property files contain the same keys.         -->
80
    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
81
    <module name="Translation"/>
82
    
83
    <!-- Checks for Size Violations.                    -->
84
    <!-- See http://checkstyle.sf.net/config_sizes.html -->
85
    <module name="FileLength"/>
86
    
87
    <!-- Checks for whitespace                               -->
88
    <!-- See http://checkstyle.sf.net/config_whitespace.html -->
89
    <module name="FileTabCharacter"/>
90

  
91

  
92
    <module name="TreeWalker">
93

  
94
	    <!-- Miscellaneous other checks.                   -->
95
	    <!-- See http://checkstyle.sf.net/config_misc.html -->
96
	    <!-- gvSIG: apply only to java files -->
97
	    <module name="RegexpSinglelineJava">
98
	       <property name="format" value="\s+$"/>
99
	       <property name="minimum" value="0"/>
100
	       <property name="maximum" value="0"/>
101
	       <property name="message" value="Line has trailing spaces."/>
102
	       <property name="ignoreComments" value="true"/>
103
	    </module>
104
	    
105
        <!-- Checks for Javadoc comments.                     -->
106
        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
107
		<!--
108
			gvSIG rule 3: All protected or public classes must have a Javadoc comments,
109
			except getters and setters
110
		-->
111
		<module name="JavadocMethod">
112
			<property name="scope" value="protected" />
113
			<property name="allowMissingPropertyJavadoc" value="true" />
114
		</module>
115
		<!--
116
			gvSIG rule 9: All classes must have a Javadoc comment
117
			with the "@author tag" and the "@version $Id$" tag included 
118
		-->
119
		<module name="JavadocType">
120
			<property name="scope" value="private" />
121
			<property name="authorFormat" value="\S" />
122
			<property name="versionFormat" value="\$Id.*\$"/>
123
		</module>
124
        <module name="JavadocVariable">
125
			<property name="scope" value="protected" />
126
		</module>
127
		<!-- gvSIG rule 3: Check correctly formatted Javadoc -->
128
		<module name="JavadocStyle">
129
			<property name="scope" value="protected" />
130
		</module>
131

  
132

  
133
        <!-- Checks for Naming Conventions.                  -->
134
        <!-- See http://checkstyle.sf.net/config_naming.html -->
135
        <module name="ConstantName"/>
136
        <module name="LocalFinalVariableName"/>
137
        <module name="LocalVariableName"/>
138
        <module name="MemberName"/>
139
        <module name="MethodName"/>
140
		<!-- gvSIG rule 15: All packages must begin with org.gvsig.  -->
141
		<module name="PackageName">
142
			<property name="format" value="^org\.gvsig(\.[a-z][a-z0-9]*)+$" />
143
		</module>
144
		<!-- gvSIG advised rule 1: Abstract class names must begin with Abstract. -->
145
		<!-- module name="AbstractClassName" /-->
146
        <module name="ParameterName"/>
147
        <module name="StaticVariableName"/>
148
        <module name="TypeName"/>
149

  
150
        <!-- Checks for imports                              -->
151
        <!-- See http://checkstyle.sf.net/config_import.html -->
152
        <module name="AvoidStarImport"/>
153
        <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
154
        <module name="RedundantImport"/>
155
        <module name="UnusedImports"/>
156

  
157

  
158
        <!-- Checks for Size Violations.                    -->
159
        <!-- See http://checkstyle.sf.net/config_sizes.html -->
160
        <module name="LineLength"/>
161
        <module name="MethodLength"/>
162
        <module name="ParameterNumber"/>
163

  
164

  
165
        <!-- Checks for whitespace                               -->
166
        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
167
        <module name="EmptyForIteratorPad"/>
168
        <module name="GenericWhitespace"/>
169
        <module name="MethodParamPad"/>
170
        <module name="NoWhitespaceAfter"/>
171
        <module name="NoWhitespaceBefore"/>
172
        <module name="OperatorWrap"/>
173
        <module name="ParenPad"/>
174
        <module name="TypecastParenPad"/>
175
        <module name="WhitespaceAfter"/>
176
        <module name="WhitespaceAround"/>
177

  
178

  
179
        <!-- Modifier Checks                                    -->
180
        <!-- See http://checkstyle.sf.net/config_modifiers.html -->
181
        <module name="ModifierOrder"/>
182
        <module name="RedundantModifier"/>
183

  
184

  
185
        <!-- Checks for blocks. You know, those {}'s         -->
186
        <!-- See http://checkstyle.sf.net/config_blocks.html -->
187
        <module name="AvoidNestedBlocks"/>
188
        <module name="EmptyBlock"/>
189
        <module name="LeftCurly"/>
190
        <module name="NeedBraces"/>
191
        <module name="RightCurly"/>
192

  
193

  
194
        <!-- Checks for common coding problems               -->
195
        <!-- See http://checkstyle.sf.net/config_coding.html -->
196
        <module name="AvoidInlineConditionals"/>
197
        <module name="DoubleCheckedLocking"/>    <!-- MY FAVOURITE -->
198
        <module name="EmptyStatement"/>
199
        <module name="EqualsHashCode"/>
200
        <module name="HiddenField"/>
201
        <module name="IllegalInstantiation"/>
202
        <module name="InnerAssignment"/>
203
        <module name="MagicNumber"/>
204
        <module name="MissingSwitchDefault"/>
205
        <module name="RedundantThrows"/>
206
        <module name="SimplifyBooleanExpression"/>
207
        <module name="SimplifyBooleanReturn"/>
208

  
209
		<!-- gvSIG: Check for some common programming errors -->
210
		<module name="CovariantEquals" />
211
		<module name="StringLiteralEquality" />
212

  
213
        <!-- Checks for class design                         -->
214
        <!-- See http://checkstyle.sf.net/config_design.html -->
215
        <module name="DesignForExtension"/>
216
        <module name="FinalClass"/>
217
        <module name="HideUtilityClassConstructor"/>
218
        <module name="InterfaceIsType"/>
219
        <module name="VisibilityModifier"/>
220

  
221

  
222
        <!-- Miscellaneous other checks.                   -->
223
        <!-- See http://checkstyle.sf.net/config_misc.html -->
224
        <module name="ArrayTypeStyle"/>
225
        <!-- gvSIG: removed -->
226
        <!-- module name="FinalParameters"/-->
227
        <module name="TodoComment"/>
228
        <module name="UpperEll"/>
229
				
230
	    <!-- gvSIG rule 2: Sun style with 4 spaces -->
231
	    <module name="Indentation">
232
	    	<property name="basicOffset" value="4"/>
233
		    <property name="caseIndent" value="0"/>
234
		</module>
235
        
236
        <!-- gvSIG rule 10: Do not use System.out/err to log -->
237
		<module name="Regexp">
238
		    <!-- . matches any character, so we need to escape it and use \. 
239
		    to match dots.-->
240
		    <property name="format" value="System\.[out|err]\.println"/>
241
		    <property name="illegalPattern" value="true"/>
242
		</module>
243
		
244
		<!-- gvSIG rule 11: Try to avoid catching Throwable or 
245
		Exception and catch specific exceptions instead. -->
246
		<module name="IllegalCatch"/>
247
		
248
		<!-- gvSIG rule 13: Use interfaces in the declaration of 
249
		methods and variables.
250
        By default only avoids usage of Classes:
251
			"java.util.GregorianCalendar, java.util.Hashtable, 
252
		  	java.util.HashSet, java.util.HashMap, java.util.ArrayList, 
253
		  	java.util.LinkedList, java.util.LinkedHashMap, 
254
		  	java.util.LinkedHashSet, java.util.TreeSet, 
255
		  	java.util.TreeMap, java.util.Vector" -->
256
		<module name="IllegalType">
257
		    <property name="ignoredMethodNames" value="getInstance"/>
258
		</module>
259
		
260
    </module>
261

  
262
	<!--  gvSIG rule 1: check for the gvSIG header -->
263
    <!-- Uneeded, use the maven-license-plugin instead
264
	<module name="RegexpHeader"> -->
265
		<!-- The follow property value demonstrates the ability     -->
266
		<!-- to have access to ANT properties. In this case it uses -->
267
		<!-- the ${basedir} property to allow Checkstyle to be run  -->
268
		<!-- from any directory within a project. See property      -->
269
		<!-- expansion,                                             -->
270
		<!-- http://checkstyle.sf.net/config.html#properties        -->
271
    <!--
272
		<property name="headerFile" value="${checkstyle.header.file}" />
273
	</module>
274
    -->
275

  
276
</module>
0 277

  
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.buildtools/src/main/resources/header.txt
1
gvSIG. Desktop Geographic Information System.
2

  
3
Copyright (C) 2007-2013 gvSIG Association.
4
  
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 3
8
of the License, or (at your option) any later version.
9
  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14
 
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
18
MA  02110-1301, USA.
19

  
20
For any additional information, do not hesitate to contact us 
21
at info AT gvsig.com, or visit our website www.gvsig.com.
0 22

  
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.buildtools/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
  <modelVersion>4.0.0</modelVersion>
4
  <groupId>org.gvsig</groupId>
5
  <artifactId>org.gvsig.desktop.buildtools</artifactId>
6
  <version>1.0.0</version>
7
  <packaging>jar</packaging>
8
  <name>${project.artifactId}</name>
9
  <description>Resources used for build gvsig desktop</description>
10

  
11

  
12
<!-- No puede ser hijo de org.gvsig.desktop para evitar referencas circulares -->
13
<!--
14
  <parent>
15
    <groupId>org.gvsig</groupId>
16
    <artifactId>org.gvsig.desktop</artifactId>
17
    <version>2.0.327-SNAPSHOT</version>
18
   </parent>  
19
-->
20

  
21

  
22
    <licenses>
23
        <license>
24
            <name>GPLv3</name>
25
            <url>http://www.gnu.org/licenses/gpl.html</url>
26
            <distribution>repo</distribution>
27
            <comments>
28
			"GPL" stands for "General Public License". The most widespread such
29
			license is the GNU General Public License, or GNU GPL for short.
30
			This can be further shortened to "GPL", when it is understood that
31
			the GNU GPL is the one intended.
32
	      	</comments>
33
        </license>
34
    </licenses>
35

  
36
    <organization>
37
        <name>gvSIG Association</name>
38
        <url>http://www.gvsig.com/</url>
39
    </organization>
40

  
41
    <scm>
42
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/trunk</connection>
43
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/trunk</developerConnection>
44
        <url>https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/show/trunk</url>
45
    </scm>
46
    
47
    <repositories>
48
      <repository>
49
        <id>gvsig-public-http-repository</id>
50
        <name>gvSIG maven public HTTP repository</name>
51
        <url>http://devel.gvsig.org/m2repo/j2se</url>
52
        <releases>
53
          <enabled>true</enabled>
54
          <updatePolicy>daily</updatePolicy>
55
          <checksumPolicy>warn</checksumPolicy>
56
        </releases>
57
        <snapshots>
58
          <enabled>true</enabled>
59
          <updatePolicy>daily</updatePolicy>
60
          <checksumPolicy>warn</checksumPolicy>
61
        </snapshots>
62
      </repository>
63
    </repositories>
64

  
65
    <distributionManagement>
66
      <site>
67
        <id>gvsig-repository</id>
68
        <url>dav:https://devel.gvsig.org/sites/${project.artifactId}/${project.version}</url>
69
      </site>
70
      <repository>
71
          <id>gvsig-repository</id>
72
          <name>gvSIG maven repository</name>
73
          <url>dav:https://devel.gvsig.org/m2repo/j2se</url>
74
          <uniqueVersion>false</uniqueVersion>
75
      </repository>
76
      <snapshotRepository>
77
          <id>gvsig-repository</id>
78
          <name>gvSIG maven repository</name>
79
          <url>dav:https://devel.gvsig.org/m2repo/j2se</url>
80
          <uniqueVersion>false</uniqueVersion>
81
      </snapshotRepository>
82
    </distributionManagement>
83
    
84
    <issueManagement>
85
      <system>redmine</system>
86
      <url>https://devel.gvsig.org/redmine/projects/gvsig-desktop</url>
87
    </issueManagement>
88

  
89
    <mailingLists>
90
      <mailingList>
91
        <name>User List</name>
92
        <subscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_usuarios</subscribe>
93
        <unsubscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_usuarios</unsubscribe>
94
        <post>gvsig_usuarios@listserv.gva.es</post>
95
        <archive>http://www.gvsig.org/web/community/mailing-lists/gvsig-nabble</archive>
96
        <otherArchives>
97
          <otherArchive>http://www.mail-archive.com/gvsig_usuarios@runas.cap.gva.es</otherArchive>
98
          <otherArchive>http://dir.gmane.org/index.php?prefix=gmane.comp.gis.gvsig</otherArchive>
99
        </otherArchives>
100
      </mailingList>
101
      <mailingList>
102
        <name>Developer List</name>
103
        <subscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_desarrolladores</subscribe>
104
        <unsubscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_desarrolladores</unsubscribe>
105
        <post>gvsig_desarrolladores@listserv.gva.es</post>
106
        <archive>http://www.gvsig.org/web/community/mailing-lists/gvsig-nabble</archive>
107
        <otherArchives>
108
          <otherArchive>http://www.mail-archive.com/gvsig_desarrolladores@runas.cap.gva.es</otherArchive>
109
          <otherArchive>http://dir.gmane.org/index.php?prefix=gmane.comp.gis.gvsig</otherArchive>
110
        </otherArchives>
111
      </mailingList>
112
      <mailingList>
113
        <name>International List</name>
114
        <subscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional</subscribe>
115
        <unsubscribe>http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional</unsubscribe>
116
        <post>gvsig_internacional@listserv.gva.es</post>
117
        <archive>http://www.gvsig.org/web/community/mailing-lists/gvsig-nabble</archive>
118
        <otherArchives>
119
          <otherArchive>http://www.mail-archive.com/gvsig_internacional@runas.cap.gva.es</otherArchive>
120
          <otherArchive>http://dir.gmane.org/index.php?prefix=gmane.comp.gis.gvsig</otherArchive>
121
        </otherArchives>
122
      </mailingList>
123
    </mailingLists>
124
    
125
    <build>
126
        <extensions>
127
            <extension>
128
                <groupId>org.apache.maven.wagon</groupId>
129
                <artifactId>wagon-webdav-jackrabbit</artifactId>
130
                <version>1.0-beta-7</version>
131
            </extension>
132
        </extensions>
133
    </build>
134

  
135
</project>
0 136

  
tags/org.gvsig.desktop-2.0.350/license.txt
1
gvSIG. Desktop Geographic Information System.
2

  
3
Copyright (C) 2007-2020 gvSIG Association.
4

  
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 3
8
of the License, or (at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14

  
15
 You should have received a copy of the GNU General Public License 
16
along with this program. If not, see <https://www.gnu.org/licenses/>. 
17

  
18
For any additional information, do not hesitate to contact us
19
at info AT gvsig.com, or visit our website www.gvsig.com.
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Compiler.java
1
package org.gvsig.expressionevaluator;
2

  
3
import org.gvsig.tools.lang.Cloneable;
4

  
5
public interface Compiler extends Cloneable {
6
    
7
    public void setLexicalAnalyzer(LexicalAnalyzer lex);
8

  
9
    public LexicalAnalyzer getLexicalAnalyzer();
10
    
11
    public void setCodeBuilder(CodeBuilder codeBuilder);
12
    
13
    public CodeBuilder getCodeBuilder();
14
    
15
    public Code compileExpression(String expression);
16

  
17
    @Override
18
    public Compiler clone() throws CloneNotSupportedException;
19

  
20
    public boolean isObjectAccessSupported();
21

  
22
    public void setObjectAccessSupported(boolean objectAccessSupported);
23
    
24
    public GrammarSet getGrammars();
25
}
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/ExpressionEvaluatorManager.java
1

  
2
package org.gvsig.expressionevaluator;
3

  
4
import java.util.Collection;
5
import java.util.List;
6
import org.gvsig.tools.bookmarksandhistory.Bookmarks;
7
import org.gvsig.tools.bookmarksandhistory.History;
8
import org.gvsig.tools.resourcesstorage.ResourcesStorage;
9
import org.gvsig.tools.script.ScriptManager;
10

  
11

  
12
public interface ExpressionEvaluatorManager extends ScriptManager {
13
  
14
    public static final String DYNAMICTEXT_STARTTAG =   "<%";
15
    public static final String DYNAMICTEXT_ENDTAG =   "%>";
16
  
17
    public Object evaluate(String source);
18
    
19
    public Object evaluate(SymbolTable symbolTable, String source);
20
    
21
    public Object evaluate(SymbolTable symbolTable, Code code);
22
    
23
    public String evaluateDynamicText(String source);    
24
    
25
    public String evaluateDynamicText(SymbolTable symbolTable, String source);    
26
    
27
    public boolean isDynamicText(String source);
28
    
29
    public Code compile(String source);
30
    
31
    public Code compile(LexicalAnalyzer lex, String source);
32
    
33
    public Code optimize(SymbolTable symbolTable, Code code);
34
    
35
    public MutableSymbolTable createSymbolTable();
36
    
37
    public SymbolTable getInmutableSymbolTable();
38
    
39
    public SymbolTable getSymbolTable(String name);
40
    
41
    public Collection<SymbolTableFactory> getSymbolTableFactories();
42
    
43
    public void registerSymbolTable(SymbolTableFactory symbolTableFactory);
44
    
45
    public LexicalAnalyzer createLexicalAnalyzer();
46
    
47
    public CodeBuilder createCodeBuilder();
48

  
49
    public Compiler createCompiler();
50
    
51
    public Interpreter createInterpreter();
52
    
53
    public Optimizer createOptimizer();
54
    
55
    public Double getAccuracy();
56
    
57
    public void setAccuracy(Double accuracy);     
58

  
59
    public Expression createExpression();
60
    
61
    public ExpressionBuilder createExpressionBuilder();
62

  
63
    public void registerExpressionBuilderFormatter(Formatter<ExpressionBuilder.Value> formatter);
64

  
65
    public Formatter<ExpressionBuilder.Value> getExpressionBuilderFormatter();
66
    
67
    public void registerGrammar(GrammarFactory factory) ;
68

  
69
    public Collection<GrammarFactory> getGrammarFactories();
70

  
71
    public Grammar createGrammar(String name);
72
    
73
    public Bookmarks<Expression> getBookmarks();
74
    
75
    public History<Expression> getHistory();
76
    
77
    public ResourcesStorage getScriptsResourcesStorage();
78

  
79
    public void setScriptsResourcesStorage(ResourcesStorage scriptsResourcesStorage);
80

  
81
    public void addReprMethod(ReprMethod method);
82
    
83
    public ReprMethod getReprMethod(Object value);
84

  
85
    public void registerClassLoader(ClassLoader loader);
86
    
87
    public List<ClassLoader> getClassLoaders();
88
    
89
    public void populateSymbolTable(SymbolTable aSymbolTable);    
90
    
91
    public ExpressionEvaluator createExpressionEvaluator(Expression expression);
92
    
93
    @Override
94
    public ExpressionEvaluator createEvaluator(String expression);
95
}
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/I18N.java
1
package org.gvsig.expressionevaluator;
2

  
3
/**
4
 *
5
 * @author jjdelcerro
6
 */
7
public class I18N {
8

  
9
    public static String Syntax_error_in_expression() {
10
        return "Syntax error in expression.";
11
    }
12

  
13
    public static String Syntax_error_near_character_XPositionX(int position) {
14
        return String.format("Syntax error near character %d.", position);
15
    }
16
    
17
    public static String Required_argument_XargnX_and_only_found_XargcX_in_call_to_XIdentifierX(String identifier, int argc, int argn) {
18
        return String.format("Requiered argument %d and only found %d in call_to '%s'.", argn,argc,identifier);
19
    }
20

  
21
    public static String The_type_of_the_argument_XargnX_for_the_XIdentifierX_function_is_incorrect(String identifier, int argn) {
22
        return String.format("The type of the argument %d for the '%s' function is incorrect.", argn,identifier);
23
    }
24

  
25
    public static String Expected_XexpectedX_and_found_XfoundX(String expected, String found) {
26
        return String.format("Expected '%s' and found '%s'.", expected,found);
27
    }
28

  
29
    public static String Illegal_null_value_for_argument_XargnX_of_XIdentifierX_function(String identifier, int n) {
30
        return String.format("Illegal null value for argument %d of '%s' function.", n, identifier);
31
    }
32
    
33
    public static String End_of_string_was_expected_and_end_of_source_was_found() {
34
        return "End of string was expected and end of source was found.";
35
    }
36
    
37
    public static String Expected_a_number_at_position_XpositionX(int position) {
38
        return String.format("Expected a number at position %d.", position);
39
    }
40

  
41
    public static String Wrong_special_number_start() {
42
        return "wrong special number start";
43
    }
44

  
45
    public static String Special_number_format_not_supported(String formatName) {
46
        return String.format("special number format '%s' not supported", formatName);
47
    }
48

  
49
    public static String Incorrect_value_for_latitude(double dd) {
50
        return String.format("Incorrect value for latitude (%f)", dd);
51
    }
52

  
53
    public static String Incorrect_value_for_longitude(double dd) {
54
        return String.format("Incorrect value for longitude (%f)", dd);
55
    }
56
    
57
    
58
}
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/CodeBuilder.java
1
package org.gvsig.expressionevaluator;
2

  
3
import java.util.Map;
4
import org.gvsig.expressionevaluator.Code.Constant;
5
import org.gvsig.expressionevaluator.Code.Identifier;
6

  
7
import org.gvsig.tools.lang.Cloneable;
8
import org.gvsig.expressionevaluator.Code.Callable;
9

  
10
public interface CodeBuilder extends Cloneable {
11

  
12
    @Override
13
    public CodeBuilder clone() throws CloneNotSupportedException;    
14
    
15
    Constant constant(Object value);
16

  
17
    Identifier identifier(String name);
18

  
19
    Callable function(String name, int type, Codes args);
20

  
21
    Callable function(String name, Codes args);
22

  
23
    Callable operator(String name, Code arg1);
24

  
25
    Callable operator(String name, Code arg1, Code arg2);
26

  
27
    Codes args();
28
    
29
    Callable tuple();
30

  
31
    Callable tuple(Codes args);
32

  
33
    Code add(Code op1, Code op2);
34

  
35
    Code subst(Code op1, Code op2);
36

  
37
    Code concat(Code op1, Code op2);
38

  
39
    Code mult(Code op1, Code op2);
40

  
41
    Code div(Code op1, Code op2);
42

  
43
    Code mod(Code op1, Code op2);
44

  
45
    Code or(Code op1, Code op2);
46

  
47
    Code and(Code op1, Code op2);
48

  
49
    Code like(Code op1, Code op2);
50

  
51
    Code ilike(Code op1, Code op2);
52

  
53
    Code regexp(Code op1, Code op2);
54

  
55
    Code lt(Code op1, Code op2);
56

  
57
    Code gt(Code op1, Code op2);
58

  
59
    Code le(Code op1, Code op2);
60

  
61
    Code ge(Code op1, Code op2);
62

  
63
    Code eq(Code op1, Code op2);
64

  
65
    Code ne(Code op1, Code op2);
66

  
67
    Code is(Code op1, Code op2);
68

  
69
    Code not(Code op1);
70

  
71
    Code negate(Code op1);
72

  
73
    Code getattr(Code obj, String attrname);
74

  
75
    Code getitem(Code obj, Code index);
76
    
77
    Code dict(Map<String,Code>map);
78

  
79
    Code method(Code obj, String methodname, Codes args);
80
    
81
    Code let(String identifier, Code value);
82
    
83
    Code $HostExpression(Code value, String mode_specier);
84
}
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Optimizer.java
1
package org.gvsig.expressionevaluator;
2

  
3
import org.gvsig.expressionevaluator.Code.Callable;
4

  
5
/**
6
 *
7
 * @author jjdelcerro
8
 */
9
public interface Optimizer {
10

  
11
    public interface FunctionOptimizer {
12
        public Code optimize(Optimizer optimizer, Callable caller);
13
    }
14
    
15
    public Code optimize(Code code);
16
    
17
    public Code optimize(SymbolTable symbolTable, Code code);
18
    
19
    public void setSymbolTable(SymbolTable symbolTable);
20
    
21
    public SymbolTable getSymbolTable();
22
    
23
    public Interpreter getInterpreter();
24
    
25
    public CodeBuilder getCodeBuilder();
26
    
27
}
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/ExpressionEvaluator.java
1
package org.gvsig.expressionevaluator;
2

  
3
import org.gvsig.tools.evaluator.EvaluatorWithDescriptions;
4
import org.gvsig.tools.persistence.Persistent;
5

  
6
/**
7
 *
8
 * @author jjdelcerro
9
 */
10
public interface ExpressionEvaluator extends EvaluatorWithDescriptions, Persistent, SupportToExpression, SupportToSymbolTable {
11

  
12
    /**
13
     * Get a SQL representation of the evaluator.
14
     *
15
     * This funcion can return a non-sql compatible expression.
16
     * 
17
     * @return the SQL string.
18
     */
19
    @Override
20
    public String getSQL();
21
    
22
    public void addSymbolTable(SymbolTable symbolTable);
23

  
24
}
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/ExpressionRuntimeException.java
1
package org.gvsig.expressionevaluator;
2

  
3
/**
4
 *
5
 * @author jjdelcerro
6
 */
7
public class ExpressionRuntimeException extends RuntimeException {
8

  
9
    private final Code code;
10
    private String tip;
11
    
12
    public ExpressionRuntimeException(Code code) {
13
        super();
14
        this.code = code;
15
    }
16

  
17
    public ExpressionRuntimeException(Code code, String message) {
18
        super(message);
19
        this.code = code;
20
    }
21

  
22
    public ExpressionRuntimeException(Code code, String message, String tip) {
23
        super(message);
24
        this.code = code;
25
        this.tip = tip;
26
    }
27

  
28
    public ExpressionRuntimeException(String message, String tip) {
29
        super(message);
30
        this.code = null;
31
        this.tip = tip;
32
    }
33

  
34
    public ExpressionRuntimeException(String message) {
35
        super(message);
36
        this.code = null;
37
    }
38

  
39
    public ExpressionRuntimeException(Code code, String message, Throwable cause) {
40
        super(message,cause);
41
        this.code = code;
42
    }
43
    
44
    public ExpressionRuntimeException(String message, Throwable cause) {
45
        super(message,cause);
46
        this.code = null;
47
    }
48
    
49
    public Code getCode() {
50
        return this.code;
51
    }
52
    
53
    public String getTip() {
54
        return this.tip;
55
    }
56
}
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Function.java
1
package org.gvsig.expressionevaluator;
2

  
3
import java.util.List;
4
import org.apache.commons.lang3.Range;
5

  
6
public interface Function {
7

  
8
    public final String GROUP_NUMERIC = "Numeric";
9
    public final String GROUP_STRING = "String";
10
    public final String GROUP_DATETIME = "Datetime";
11
    public final String GROUP_BOOLEAN = "Boolean";
12
    public final String GROUP_OGC = "OGC";
13
    public final String GROUP_PROGRAMMING = "Programming";
14
    public final String GROUP_CONVERSION = "Conversion";
15
    public final String GROUP_AGGREGATE = "Aggregate";
16
    public final String GROUP_OTHER = "Other";
17
   
18
    public String group();
19

  
20
    public String name();
21
    
22
    public String returnType();
23

  
24
    public Range argc();
25

  
26
    public String description();
27

  
28
    /**
29
     * Return a full description of the funcion internationalized in HTML.
30
     * This full description contains, t name, description, args, template and
31
     * return type.
32
     * 
33
     * @return full description in HTML as a String
34
     */
35
    public String getFullDescription();
36
    
37
    public String template();
38
    
39
    public String[] descriptionArgs();
40

  
41
    public Object call(Interpreter interpreter, Object[] args) throws Exception;
42
    
43
    public Object call(Interpreter interpreter, Codes args) throws Exception;
44
    
45
    public void addAlias(String name);
46
    
47
    public List<String> aliases();
48
    
49
    public boolean isOperator();
50
    
51
    public boolean isHidden();
52
    
53
    public boolean useArgumentsInsteadObjects();
54
    
55
    public boolean isSQLCompatible();
56
    
57
    /**
58
     * Returns true if the function always returns the same value for 
59
     * the same parameters. If so, it is possible to optimize the 
60
     * generated code through the process of "constant folding".
61
     * 
62
     * https://en.wikipedia.org/wiki/Constant_folding
63
     * 
64
     * @return true if this function allow constant folding optimization.
65
     */
66
    public boolean allowConstantFolding();
67
    
68
    public String toString(Codes args, Formatter<Code> formatter);
69
    
70
}
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/ExpressionSyntaxException.java
1
package org.gvsig.expressionevaluator;
2

  
3
import org.apache.commons.lang3.StringUtils;
4

  
5
/**
6
 *
7
 * @author jjdelcerro
8
 */
9
public class ExpressionSyntaxException extends RuntimeException {
10

  
11
    private final int position;
12
    private final int line;
13
    private final int column;
14
    private final String phrase;
15
    private final String description;
16
    private final String tip;
17
    
18
    public ExpressionSyntaxException() {
19
        super("Syntax error in expression.");
20
        this.phrase = null;
21
        this.position = -1;
22
        this.line = -1;
23
        this.column = -1;
24
        this.description = I18N.Syntax_error_in_expression();
25
        this.tip = null;
26
    }
27
    
28
    public ExpressionSyntaxException(LexicalAnalyzer lexer) {
29
        this(null, lexer, null);
30
    }
31
    
32
    public ExpressionSyntaxException(String msg, LexicalAnalyzer lexer) {
33
        this(msg, lexer, null);
34
    }
35

  
36
    public ExpressionSyntaxException(String msg, LexicalAnalyzer lexer, String tip) {
37
        this(msg, lexer.getSource(), lexer.getMaxPosition(), lexer.getMaxLine(), lexer.getMaxColumn(), tip);
38
    }
39
    
40
    public ExpressionSyntaxException(String phrase, int position) {
41
        this(null, phrase, position, -1, -1, null);
42
    }
43
    
44
    public ExpressionSyntaxException(String msg, String phrase, int position, String tip) {
45
        this(msg, phrase, position, -1, -1, tip);
46
    }
47
    
48
    public ExpressionSyntaxException(String msg, String phrase, int position, int line, int column, String tip) {
49
        super("Syntax error in '"+getSource(phrase, position) +"' near character "+ formatPosition(position,line,column) + ". " + StringUtils.trimToEmpty(msg));
50
        this.phrase = phrase;
51
        this.position = position;
52
        this.line = line;
53
        this.column = column;
54
        if( StringUtils.isBlank(msg) ) {
55
            this.description = I18N.Syntax_error_near_character_XPositionX(position);
56
        } else {
57
            this.description = I18N.Syntax_error_near_character_XPositionX(position)+ " "+msg;
58
        }
59
        this.tip = tip;
60
    }
61

  
62
    private static String formatPosition(int position, int line, int column) {
63
        if( line<0 || column<0 ) {
64
            return String.valueOf(position);
65
        }
66
        return position + " ("+line+":"+column+")";
67
    }
68
    
69
    private static String getSource(String source, int position) {
70
        String s = StringUtils.left(source, position) + "[*]" + StringUtils.mid(source, position, 200);
71
        if( s.length()>200 ) {
72
            s = "..."+StringUtils.mid(s, position-100, 200)+"...";
73
        }
74
        return s;
75
    }
76
    
77
    public String getPhrase() {
78
        return this.phrase;
79
    }
80
    
81
    public int getPosition() {
82
        return this.position;
83
    }
84
    
85
    public int getLine() {
86
        return this.line;
87
    }
88
    
89
    public int getColumn() {
90
        return this.column;
91
    }
92
    
93
    public String getDescription() {
94
        return this.description;
95
    }
96
    
97
    public String getTip() {
98
        return this.tip;
99
    }
100
}
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/MutableSymbolTable.java
1
package org.gvsig.expressionevaluator;
2

  
3
import java.util.Collection;
4

  
5
public interface MutableSymbolTable extends SymbolTable {
6

  
7
    public void setVar(String name, Object value);
8
    
9
    public void addFunction(Function function);
10
    
11
//    public void addScript(Script script);
12
    
13
    public void addFunctions(Collection<Function> functions);
14

  
15
    public void removeVar(String name);
16
    
17
//    public void removeScript(Script script);
18
    
19
    public void removeFunction(String name);
20

  
21
    @Override
22
    public MutableSymbolTable clone() throws CloneNotSupportedException;
23
}
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Expression.java
1
package org.gvsig.expressionevaluator;
2

  
3
import org.gvsig.json.SupportJson;
4
import org.gvsig.tools.evaluator.Evaluator;
5
import org.gvsig.tools.persistence.Persistent;
6

  
7
/**
8
 *
9
 * @author jjdelcerro
10
 */
11
public interface Expression extends Persistent, Cloneable, SupportJson {
12
    public void clear();
13
    
14
    /**
15
     * This symbol table don't persist with the expression.
16
     * 
17
     * @return the symbol table of the expression
18
     */
19
    public SymbolTable getSymbolTable();
20
    
21
    public String getPhrase();
22
    
23
    public Expression setPhrase(String phrase);
24
        
25
    public Object execute(SymbolTable symbolTable);
26
    
27
    public void link(SymbolTable symbolTable);    
28
    
29
    public Code getCode();
30
    
31
    @Deprecated
32
    public String toJSON();
33
    
34
    @Deprecated
35
    public void fromJSON(String json);
36
    
37
    public Expression clone() throws CloneNotSupportedException;
38
    
39
    public boolean isPhraseEmpty();
40
    
41
    public boolean isEmpty();
42
    
43
    public void setSQLCompatible(boolean sqlCompatible);
44
    
45
    public boolean isSQLCompatible();
46

  
47
    public void setUseBracketsForIdentifiers(boolean useBracketsForIdentifiers);
48
    
49
    public boolean getUseBracketsForIdentifiers();
50
    
51
    public Evaluator toEvaluator();
52
}
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/SupportToExpression.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.expressionevaluator;
7

  
8
/**
9
 *
10
 * @author fdiaz
11
 */
12
public interface SupportToExpression {
13
    
14
    public Expression toExpression();
15
    
16
}
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/AttributeHandler.java
1
package org.gvsig.expressionevaluator;
2

  
3
import org.gvsig.tools.util.GetItemByKey;
4

  
5
/**
6
 *
7
 * @author jjdelcerro
8
 */
9
public interface AttributeHandler extends GetItemByKey<String, Object> {
10

  
11
}
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Formatter.java
1
package org.gvsig.expressionevaluator;
2

  
3
/**
4
 *
5
 * @author jjdelcerro
6
 * @param <T>
7
 */
8
public interface Formatter<T> {
9

  
10
    public boolean canApply(T value);
11

  
12
    public String format(T value);
13
    
14
}
tags/org.gvsig.desktop-2.0.350/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/ExpressionBuilder.java
1
package org.gvsig.expressionevaluator;
2

  
3
import java.awt.Color;
4
import java.util.Date;
5
import java.util.List;
6
import java.util.Map;
7
import org.gvsig.tools.util.PropertiesSupport;
8
import org.gvsig.tools.util.PropertiesSupportHelper;
9

  
10
public interface ExpressionBuilder extends PropertiesSupport {
11

  
12
    public static final String OPERATOR_NOT = "NOT";
13
    public static final String OPERATOR_NEGATE = "NEGATE";
14
    public static final String OPERATOR_IS = "IS";
15
    public static final String OPERATOR_IS_NULL = "IS NULL";
16
    public static final String OPERATOR_IS_NOT_NULL = "IS NOT NULL";
17
    public static final String OPERATOR_AND = "AND";
18
    public static final String OPERATOR_OR = "OR";
19
    public static final String OPERATOR_EQ = "=";
20
    public static final String OPERATOR_NE = "<>";
21
    public static final String OPERATOR_GT = ">";
22
    public static final String OPERATOR_GE = ">=";
23
    public static final String OPERATOR_LT = "<";
24
    public static final String OPERATOR_LE = "<=";
25
    public static final String OPERATOR_LIKE = "LIKE";
26
    public static final String OPERATOR_ILIKE = "ILIKE";
27
    public static final String OPERATOR_ADD = "+";
28
    public static final String OPERATOR_SUBST = "-";
29
    public static final String OPERATOR_MULT = "*";
30
    public static final String OPERATOR_DIV = "/";
31
    public static final String OPERATOR_MOD = "%";
32
    public static final String OPERATOR_CONCAT = "||";
33
    public static final String OPERATOR_REGEXP = "~";
34
    public static final String OPERATOR_AND2 = "&&";
35

  
36
    public static final String FUNCTION_CASE = "CASE";
37
    public static final String FUNCTION_IIF = "IIF";
38
    public static final String FUNCTION_IF = "IF";
39
    public static final String FUNCTION_IFNULL = "IFNULL";
40
    
41
    public static final String FUNCTION_LEFT = "LEFT";
42
    public static final String FUNCTION_RIGHT = "RIGHT";
43
    public static final String FUNCTION_LOCATE = "LOCATE";
44
    public static final String FUNCTION_POSITION = "POSITION";
45
    public static final String FUNCTION_LPAD = "LPAD";
46
    public static final String FUNCTION_RPAD = "RPAD";
47
    public static final String FUNCTION_LTRIM = "LTRIM";
48
    public static final String FUNCTION_RTRIM = "RTRIM";
49
    public static final String FUNCTION_TRIM = "TRIM";
50
    public static final String FUNCTION_REPEAT = "REPEAT";
51
    public static final String FUNCTION_REPLACE = "REPLACE";
52
    public static final String FUNCTION_ASCII = "ASCII";
53
    public static final String FUNCTION_LENGHT = "LENGHT";
54
    public static final String FUNCTION_INSTR = "INSTR";
55
    public static final String FUNCTION_LOWER = "LOWER";
56
    public static final String FUNCTION_UPPER = "UPPER";
57
    public static final String FUNCTION_SPACE = "SPACE";
58
    public static final String FUNCTION_SUBSTRING = "SUBSTRING";
59
    public static final String FUNCTION_CONCAT = "CONCAT";
60
    public static final String FUNCTION_ABS = "ABS";
61
    public static final String FUNCTION_ACOS = "ACOS";
62
    public static final String FUNCTION_ASIN = "ASIN";
63
    public static final String FUNCTION_ATAN = "ATAN";
64
    public static final String FUNCTION_COS = "COS";
65
    public static final String FUNCTION_COSH = "COSH";
66
    public static final String FUNCTION_COT = "COT";
67
    public static final String FUNCTION_BITAND = "BITAND";
68
    public static final String FUNCTION_BITOR = "BITOR";
69
    public static final String FUNCTION_BITXOR = "BITXOR";
70
    public static final String FUNCTION_CEIL = "CEIL";
71
    public static final String FUNCTION_DEGREES = "DEGREES";
72
    public static final String FUNCTION_EXP = "EXP";
73
    public static final String FUNCTION_FLOOR = "FLOOR";
74
    public static final String FUNCTION_LOG = "LOG";
75
    public static final String FUNCTION_LOG10 = "LOG10";
76
    public static final String FUNCTION_PI = "PI";
77
    public static final String FUNCTION_POWER = "POWER";
78
    public static final String FUNCTION_RADIANS = "RADIANS";
79
    public static final String FUNCTION_RAND = "RAND";
80
    public static final String FUNCTION_ROUND = "ROUND";
81
    public static final String FUNCTION_SQRT = "SQRT";
82
    public static final String FUNCTION_SIGN = "SIGN";
83
    public static final String FUNCTION_SIN = "SIN";
84
    public static final String FUNCTION_SINH = "SINH";
85
    public static final String FUNCTION_TAN = "TAN";
86
    public static final String FUNCTION_TANH = "TANH";
87
    public static final String FUNCTION_ZERO = "ZERO";
88
    public static final String FUNCTION_CHR = "CHR";
89
    public static final String FUNCTION_MOD = "MOD";
90
    public static final String FUNCTION_UUID = "UUID";
91

  
92
    public static final String FUNCTION_DATE = "DATE";
93
    public static final String FUNCTION_TIME = "TIME";
94
    public static final String FUNCTION_TIMESTAMP = "TIMESTAMP";  
95

  
96
    public static final String FUNCTION_TO_DATE = "TO_DATE";
97
    public static final String FUNCTION_TO_TIMESTAMP = "TO_TIMESTAMP";  
98
    public static final String FUNCTION_DATEDIFF = "DATEDIFF";
99
    public static final String FUNCTION_DATEADD = "DATEADD";
100
    public static final String FUNCTION_CURRENT_TIMESTAMP = "CURRENT_TIMESTAMP";
101
    public static final String FUNCTION_CURRENT_TIME = "CURRENT_TIME";
102
    public static final String FUNCTION_CURRENT_DATE = "CURRENT_DATE";
103
    public static final String FUNCTION_EXTRACT = "EXTRACT";
104
    
105
    public static final String FUNCTION_CAST = "CAST";
106
    public static final String FUNCTION_DECODE = "DECODE";
107
    public static final String FUNCTION_ENCODE = "ENCODE";
108
    public static final String FUNCTION_TODOUBLE = "TODOUBLE";
109
    public static final String FUNCTION_TOFLOAT = "TOFLOAT";
110
    public static final String FUNCTION_TOINTEGER = "TOINTEGER";
111
    public static final String FUNCTION_TOLONG = "TOLONG";
112
    public static final String FUNCTION_TOSTR = "TOSTR";
113
    public static final String FUNCTION_TOJSON = "TO_JSON";
114
    public static final String FUNCTION_MAP = "MAP";
115
    
116
    public static final String FUNCTION_LET = "LET";
117

  
118
    public static final String FUNCTION_INCR = "INCR";
119
    public static final String FUNCTION_DECR = "DECR";
120
    
121
    public static final String FUNCTION_RANGE = "RANGE";
122
    public static final String FUNCTION_EVAL = "EVAL";
123
    public static final String FUNCTION_LIST = "LIST";
124
    public static final String FUNCTION_TUPLE = "TUPLE";
125
    public static final String FUNCTION_DICT = "DICT";
126
    public static final String FUNCTION_$CONSTANT = "$CONSTANT";
127
    public static final String FUNCTION_$IDENTIFIER = "$IDENTIFIER";
128
    public static final String FUNCTION_$HOSTEXPRESSION = "$HOSTEXPRESSION";
129
    
130
    public static final String FUNCTION_GETATTR = "GETATTR";
131
    public static final String FUNCTION_GETITEM = "GETITEM";
132
    public static final String FUNCTION_URLREAD = "URL_READ";
133
    public static final String FUNCTION_URLREADBYTES = "URL_READBYTES";
134
    public static final String FUNCTION_URL = "URL";
135

  
136
    public static final String FUNCTION_COLOR = "COLOR";
137
    
138
    public static final String FUNCTION_JSON_VALUE = "JSON_VALUE";
139
    
140
    public static final int PARAMETER_TYPE_CONSTANT = 0;
141
    public static final int PARAMETER_TYPE_VARIABLE = 1;
142
    
143
    public interface VisitorFilter {
144
        boolean accept(Visitable visitable);
145
    }
146

  
147
     public interface Visitor {
148
        public void visit(Visitable value);
149
    }
150

  
151
    public interface Visitable {
152
        public void accept(Visitor visitor, VisitorFilter filter);
153
    }
154
        
155
    public interface Value extends Visitable, PropertiesSupport, org.gvsig.tools.lang.Cloneable {
156
        public String toString(Formatter<Value> formatter);
157
        public void replace(Value target, Value replacement);
158
        public void copyPropertiesFrom(PropertiesSupport properties);
159

  
160
        @Override
161
        public Value clone() throws CloneNotSupportedException;
162
        
163
    }
164

  
165
    public interface Group extends Value {
166
        public Value value();
167
    }
168

  
169
    public interface Constant extends Value {
170
        public Object value();
171
    }
172

  
173
    public interface Custom extends Value {
174
        public Object value();
175
        public Custom add(Variable variable);
176
        public Custom add(Parameter parameter);
177
    }
178

  
179
    public interface Variable extends Value, Comparable<Variable> {
180
        public String name();
181
    }
182

  
183
    public interface Parameter extends Value {
184
        public Parameter as_constant();
185
        public Parameter as_variable();        
186
        public Parameter value(Object value);
187
        public Parameter name(String value);
188
        public int type();
189
        public String name();
190
        public Object value();
191
        public boolean is_constant();
192
        public boolean is_variable();
193
    }
194
    
195
    public interface Function extends Value {
196
        public String name();
197
        public List<Value> parameters();
198
        public Function parameter(Value parameter);
199
        public Function format(String format);
200
    }
201

  
202
    public interface Method extends Value {
203
        public String name();
204
        public Value instance();
205
        public List<Value> parameters();
206
        public Function parameter(Value parameter);
207
    }
208

  
209
    public interface BinaryOperator extends Function {
210
        public String name();
211
        public Value left();
212
        public Value right();
213
        public BinaryOperator left(Value operand);
214
        public BinaryOperator right(Value operand);
215
    }
216

  
217
    public abstract class AbstractValue implements Value {
218

  
219
        protected PropertiesSupportHelper properties;
220
        
221
        protected AbstractValue() {
222
            this.properties = new PropertiesSupportHelper();
223
        }
224

  
225
        @Override
226
        public Value clone() throws CloneNotSupportedException {
227
            AbstractValue other = (AbstractValue) super.clone();
228
            other.properties = properties.clone();
229
            return other;
230
        }
231
        
232
        
233
        @Override
234
        public void copyPropertiesFrom(PropertiesSupport properties) {
235
            for (Map.Entry<String, Object> entry : properties.getProperties().entrySet()) {
236
                String key = entry.getKey();
237
                Object value1 = entry.getValue();
238
                this.setProperty(key, value1);
239
            }
240
        }
241
        
242
        @Override
243
        public void accept(Visitor visitor, VisitorFilter filter) {
244
            if (filter == null || filter.accept(this)) {
245
                visitor.visit(this);
246
            }
247
        }
248

  
249
        @Override
250
        public Map<String, Object> getProperties() {
251
            return this.properties.getProperties();
252
        }
253

  
254
        @Override
255
        public Object getProperty(String name) {
256
            return this.properties.getProperty(name);
257
        }
258

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

Also available in: Unified diff