Source Code Cross Referenced for BuildResultStack.java in  » GIS » GeoTools-2.4.1 » org » geotools » filter » text » cql2 » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.filter.text.cql2 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2006, GeoTools Project Managment Committee (PMC)
005:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation;
009:         *    version 2.1 of the License.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         */
016:        package org.geotools.filter.text.cql2;
017:
018:        import java.util.EmptyStackException;
019:        import java.util.Stack;
020:
021:        import org.opengis.filter.expression.Literal;
022:        import org.opengis.filter.expression.PropertyName;
023:
024:        /**
025:         * Holds the results of the building process in a stack
026:         *
027:         * @author Mauricio Pazos - Axios Engineering
028:         * @author Gabriel Roldan - Axios Engineering
029:         * @version $Id: BuildResultStack.java 25209 2007-04-20 11:09:26Z vmpazos $
030:         * @since 2.4
031:         */
032:        final class BuildResultStack {
033:
034:            private Stack stack = new Stack();
035:
036:            private String cqlSource;
037:
038:            public BuildResultStack(final String cqlSource) {
039:                assert cqlSource != null;
040:
041:                this .cqlSource = cqlSource;
042:            }
043:
044:            public Result peek() {
045:                return (Result) stack.peek();
046:            }
047:
048:            public boolean empty() {
049:                return stack.empty();
050:            }
051:
052:            public Result popResult() throws CQLException {
053:                Result item = null;
054:
055:                try {
056:                    return (Result) stack.pop();
057:                } catch (ClassCastException cce) {
058:                    throw new CQLException(
059:                            "Expecting Expression, but found Filter", item
060:                                    .getToken(), cce, this .cqlSource);
061:                } catch (EmptyStackException ese) {
062:                    throw new CQLException("No items on stack");
063:                }
064:            }
065:
066:            public org.opengis.filter.expression.Expression popExpression()
067:                    throws CQLException {
068:                Result item = null;
069:
070:                try {
071:                    item = (Result) stack.pop();
072:
073:                    return (org.opengis.filter.expression.Expression) item
074:                            .getBuilt();
075:                } catch (ClassCastException cce) {
076:                    throw new CQLException(
077:                            "Expecting Expression, but found Filter", item
078:                                    .getToken(), cce, this .cqlSource);
079:                } catch (EmptyStackException ese) {
080:                    throw new CQLException("No items on stack");
081:                }
082:            }
083:
084:            public Literal popLiteral() throws CQLException {
085:                Result item = null;
086:
087:                try {
088:                    item = (Result) stack.pop();
089:
090:                    return (Literal) item.getBuilt();
091:                } catch (ClassCastException cce) {
092:                    throw new CQLException(
093:                            "Expecting Expression, but found Filter", item
094:                                    .getToken(), cce, this .cqlSource);
095:                } catch (EmptyStackException ese) {
096:                    throw new CQLException("No items on stack");
097:                }
098:            }
099:
100:            public PropertyName popPropertyName() throws CQLException {
101:                Result item = null;
102:
103:                try {
104:                    item = (Result) stack.pop();
105:
106:                    return (PropertyName) item.getBuilt();
107:                } catch (ClassCastException cce) {
108:                    throw new CQLException(
109:                            "Expecting Expression, but found Filter", item
110:                                    .getToken(), cce, this .cqlSource);
111:                } catch (EmptyStackException ese) {
112:                    throw new CQLException("No items on stack");
113:                }
114:            }
115:
116:            public org.opengis.filter.Filter popFilter() throws CQLException {
117:                Result item = null;
118:
119:                try {
120:                    item = (Result) stack.pop();
121:
122:                    return (org.opengis.filter.Filter) item.getBuilt();
123:                } catch (ClassCastException cce) {
124:                    throw new CQLException(
125:                            "Expecting Filter, but found Expression", item
126:                                    .getToken(), cce, this .cqlSource);
127:                } catch (EmptyStackException ese) {
128:                    throw new CQLException("No items on stack");
129:                }
130:            }
131:
132:            public PeriodNode popPeriod() throws CQLException {
133:                Result item = null;
134:
135:                try {
136:                    item = (Result) stack.pop();
137:
138:                    return (PeriodNode) item.getBuilt();
139:                } catch (ClassCastException cce) {
140:                    throw new CQLException(
141:                            "Expecting Filter, but found Expression", item
142:                                    .getToken(), cce, this .cqlSource);
143:                } catch (EmptyStackException ese) {
144:                    throw new CQLException("No items on stack");
145:                }
146:            }
147:
148:            public double popDoubleValue() throws CQLException {
149:                try {
150:                    Literal expr = this .popLiteral();
151:                    Double number = new Double(expr.getValue().toString());
152:
153:                    return number.doubleValue();
154:                } catch (ClassCastException cce) {
155:                    throw new CQLException("Expected double");
156:                }
157:            }
158:
159:            public int popIntegerValue() throws CQLException {
160:                try {
161:                    Literal expr = this .popLiteral();
162:                    Integer number = (Integer) expr.getValue();
163:
164:                    return number.intValue();
165:                } catch (ClassCastException cce) {
166:                    throw new CQLException("Expected double");
167:                }
168:            }
169:
170:            public String popStringValue() throws CQLException {
171:                Literal literal = this .popLiteral();
172:
173:                return literal.toString();
174:            }
175:
176:            public String popIdentifierPart() throws CQLException {
177:                try {
178:                    Result resultPart = (Result) stack.pop();
179:                    Token token = resultPart.getToken();
180:
181:                    return token.image;
182:                } catch (ClassCastException e) {
183:                    throw new CQLException("identifier part is expected");
184:                }
185:            }
186:
187:            public String popIdentifier() throws CQLException {
188:                try {
189:                    Result result = (Result) stack.pop();
190:                    String identifier = (String) result.getBuilt();
191:
192:                    return identifier;
193:                } catch (ClassCastException e) {
194:                    throw new CQLException("fail in identifier parsing");
195:                }
196:            }
197:
198:            public void push(Result item) {
199:                stack.push(item);
200:            }
201:
202:            public int size() {
203:                return stack.size();
204:            }
205:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.