Source Code Cross Referenced for NullFilterImpl.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 org.geotools.feature.Feature;
019:        import org.opengis.filter.FilterVisitor;
020:        import org.opengis.filter.PropertyIsNull;
021:
022:        /**
023:         * Defines a null filter, which checks to see if an attribute is null.
024:         *
025:         * @author Rob Hranac, Vision for New York
026:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/filter/NullFilterImpl.java $
027:         * @version $Id: NullFilterImpl.java 24253 2007-02-07 13:19:42Z groldan $
028:         */
029:        public class NullFilterImpl extends AbstractFilterImpl implements 
030:                NullFilter {
031:            /** The null check value, which must be an attribute expression. */
032:            private org.opengis.filter.expression.Expression nullCheck = null;
033:
034:            /**
035:             * Constructor which sets the type as null check.
036:             */
037:            protected NullFilterImpl() {
038:                super (FilterFactoryFinder.createFilterFactory());
039:                filterType = NULL;
040:            }
041:
042:            /**
043:             * Determines whether or not a given feature is 'inside' this filter.
044:             *
045:             * @param nullCheck The attribute expression to null check.
046:             *
047:             * @throws IllegalFilterException If attempting to add a non-attribute
048:             *         expression.
049:             *
050:             * @task REVISIT: change arg to AttributeExpression?
051:             * @task REVISIT: change name to setNullCheckValue.
052:             * 
053:             * @deprecated use {@link PropertyIsNull#setExpression(Expression)}
054:             */
055:            public final void nullCheckValue(Expression nullCheck)
056:                    throws IllegalFilterException {
057:                setExpression(nullCheck);
058:            }
059:
060:            /**
061:             * Returns the expression being checked for null.
062:             *
063:             * @return the Expression to null check.
064:             * 
065:             * @deprecated use {@link #getExpression()}.
066:             */
067:            public final Expression getNullCheckValue() {
068:                return (Expression) getExpression();
069:            }
070:
071:            /**
072:             * Returns the expression which represents the null check.
073:             */
074:            public org.opengis.filter.expression.Expression getExpression() {
075:                return nullCheck;
076:            }
077:
078:            /**
079:             * Sets the expression which represents the null check.
080:             */
081:            public void setExpression(
082:                    org.opengis.filter.expression.Expression nullCheck) {
083:                if (nullCheck instanceof  AttributeExpression) {
084:                    this .nullCheck = nullCheck;
085:                } else {
086:                    throw new IllegalFilterException(
087:                            "Attempted to add non-attribute expression to a null filter.");
088:                }
089:            }
090:
091:            /**
092:             * Determines whether or not a given feature is 'inside' this filter.
093:             *
094:             * @param feature Specified feature to examine.
095:             *
096:             * @return Flag confirming whether or not this feature is inside the
097:             *         filter.
098:             */
099:            public boolean evaluate(Object feature) {
100:                if (nullCheck == null) {
101:                    return false;
102:                } else {
103:                    return (nullCheck.evaluate(feature) == null);
104:                }
105:            }
106:
107:            /**
108:             * Returns a string representation of this filter.
109:             *
110:             * @return String representation of the null filter.
111:             */
112:            public String toString() {
113:                return "[ " + nullCheck.toString() + " is null ]";
114:            }
115:
116:            /**
117:             * Compares this filter to the specified object.  Returns true  if the
118:             * passed in object is the same as this filter.  Checks  to make sure the
119:             * filter types, and the NullCheckValue are the same.
120:             *
121:             * @param obj - the object to compare this LikeFilter against.
122:             *
123:             * @return true if specified object is equal to this filter; false
124:             *         otherwise.
125:             */
126:            public boolean equals(Object obj) {
127:                if (obj != null && obj.getClass() == this .getClass()) {
128:                    NullFilterImpl nullFilter = (NullFilterImpl) obj;
129:
130:                    return ((nullFilter.getFilterType() == this .filterType) && nullFilter
131:                            .getNullCheckValue().equals(this .nullCheck));
132:                } else {
133:                    return false;
134:                }
135:            }
136:
137:            /**
138:             * Override of hashCode method.
139:             *
140:             * @return a hash code value for this geometry filter.
141:             */
142:            public int hashCode() {
143:                int result = 17;
144:                result = (37 * result)
145:                        + ((nullCheck == null) ? 0 : nullCheck.hashCode());
146:
147:                return result;
148:            }
149:
150:            /**
151:             * Used by FilterVisitors to perform some action on this filter instance.
152:             * Typicaly used by Filter decoders, but may also be used by any thing
153:             * which needs infomration from filter structure. Implementations should
154:             * always call: visitor.visit(this); It is importatant that this is not
155:             * left to a parent class unless the parents API is identical.
156:             *
157:             * @param visitor The visitor which requires access to this filter, the
158:             *        method must call visitor.visit(this);
159:             */
160:            public Object accept(FilterVisitor visitor, Object extraData) {
161:                return visitor.visit(this, extraData);
162:            }
163:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.