Source Code Cross Referenced for AttributeExpressionImpl2.java in  » GIS » GeoTools-2.4.1 » org » geotools » filter » 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 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2002-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;
017:
018:        import java.util.logging.Logger;
019:
020:        import org.geotools.feature.AttributeType;
021:        import org.geotools.feature.Feature;
022:        import org.geotools.feature.FeatureType;
023:        import org.opengis.filter.expression.ExpressionVisitor;
024:
025:        /**
026:         * Defines a complex filter (could also be called logical filter). This filter
027:         * holds one or more filters together and relates them logically in an
028:         * internally defined manner.
029:         *
030:         * @author Rob Hranac, TOPP
031:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/filter/AttributeExpressionImpl2.java $
032:         * @version $Id: AttributeExpressionImpl2.java 27862 2007-11-12 19:51:19Z desruisseaux $
033:         */
034:        public class AttributeExpressionImpl2 extends DefaultExpression
035:                implements  AttributeExpression {
036:            /** The logger for the default core module. */
037:            private static final Logger LOGGER = org.geotools.util.logging.Logging
038:                    .getLogger("org.geotools.core");
039:
040:            /** Holds all sub filters of this filter. */
041:            protected String attPath;
042:
043:            /** Holds all sub filters of this filter. */
044:            protected AttributeType at = null;
045:
046:            /**
047:             * Constructor with the schema for this attribute.
048:             *
049:             * @param at the AttributeType schema for this attribute.
050:             */
051:            protected AttributeExpressionImpl2(AttributeType at) {
052:                this .at = at;
053:                this .expressionType = ATTRIBUTE;
054:            }
055:
056:            /**
057:             * Constructor with minimum dataset for a valid expression.
058:             *
059:             * @param attPath The initial (required) sub filter.
060:             *
061:             * @throws IllegalFilterException If the attribute path is not in the
062:             *         schema.
063:             *         
064:             *  @deprecated use {@link #setPropertyName(String)}.
065:             */
066:            public final void setAttributePath(String attPath)
067:                    throws IllegalFilterException {
068:                setPropertyName(attPath);
069:            }
070:
071:            /**
072:             * This method calls {@link #getPropertyName()}.
073:             * 
074:             * @deprecated use {@link #getPropertyName()}
075:             */
076:            public final String getAttributePath() {
077:                return getPropertyName();
078:            }
079:
080:            /**
081:             * Gets the path to the attribute to be evaluated by this expression.
082:             *
083:             * {@link org.opengis.filter.expression.PropertyName#getPropertyName()}.
084:             */
085:            public String getPropertyName() {
086:                return attPath;
087:            }
088:
089:            /**
090:             * Unsupported operation
091:             * 
092:             * @throws IllegalFilterException.
093:             */
094:            public void setPropertyName(String name) {
095:
096:                throw new IllegalFilterException("Attribute: " + attPath
097:                        + " is not in stated schema " + ".");
098:
099:            }
100:
101:            /**
102:             * Gets the value of this attribute from the passed feature.
103:             *
104:             * @param feature Feature from which to extract attribute value.
105:             */
106:            public Object evaluate(Feature feature) {
107:                return feature.getAttribute(attPath);
108:            }
109:
110:            /* shouldn't this class dissapear as AttributeExpressionImpl does the job pretty well now?*/
111:            public Object evaluate(Object object) {
112:                if (object instanceof  Feature) {
113:                    return evaluate((Feature) object);
114:                }
115:                return null;//just to respect old behavoir
116:            }
117:
118:            /**
119:             * Return this expression as a string.
120:             *
121:             * @return String representation of this attribute expression.
122:             */
123:            public String toString() {
124:                return attPath;
125:            }
126:
127:            /**
128:             * Compares this filter to the specified object.  Returns true  if the
129:             * passed in object is the same as this expression.  Checks  to make sure
130:             * the expression types are the same as well as  the attribute paths and
131:             * schemas.
132:             *
133:             * @param obj - the object to compare this ExpressionAttribute against.
134:             *
135:             * @return true if specified object is equal to this filter; else false
136:             */
137:            public boolean equals(Object obj) {
138:                if (obj.getClass() == this .getClass()) {
139:                    AttributeExpressionImpl2 expAttr = (AttributeExpressionImpl2) obj;
140:
141:                    boolean isEqual = (expAttr.getType() == this .expressionType);
142:                    isEqual = (expAttr.attPath != null) ? (isEqual && expAttr.attPath
143:                            .equals(this .attPath))
144:                            : (isEqual && (this .attPath == null));
145:
146:                    return isEqual;
147:                } else {
148:                    return false;
149:                }
150:            }
151:
152:            /**
153:             * Override of hashCode method.
154:             *
155:             * @return a code to hash this object by.
156:             */
157:            public int hashCode() {
158:                int result = 17;
159:                result = (37 * result)
160:                        + (attPath == null ? 0 : attPath.hashCode());
161:                return result;
162:            }
163:
164:            /**
165:             * Used by FilterVisitors to perform some action on this filter instance.
166:             * Typicaly used by Filter decoders, but may also be used by any thing
167:             * which needs infomration from filter structure. Implementations should
168:             * always call: visitor.visit(this); It is importatant that this is not
169:             * left to a parent class unless the  parents API is identical.
170:             *
171:             * @param visitor The visitor which requires access to this filter, the
172:             *        method must call visitor.visit(this);
173:             */
174:            public Object accept(ExpressionVisitor visitor, Object extraData) {
175:                return visitor.visit(this, extraData);
176:            }
177:
178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.