Source Code Cross Referenced for AndFilter.java in  » Content-Management-System » openedit » com » openedit » util » strainer » 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 » Content Management System » openedit » com.openedit.util.strainer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: AndFilter.java,v 1.1 2005/05/27 19:32:25 cburkey Exp $
003:         */
004:        package com.openedit.util.strainer;
005:
006:        /**
007:         * This is a combinatorial filter which ANDs together all of its sub-filters.
008:         * 
009:         * @author Eric Galluzzo
010:         */
011:        public class AndFilter implements  CompositeFilter {
012:            protected Filter[] fieldFilters;
013:
014:            /**
015:             * This constructor should only be used for JavaBean-style creation.
016:             */
017:            public AndFilter() {
018:            }
019:
020:            /**
021:             * Create a filter that ANDs together all the given sub-filters.
022:             * 
023:             * @param inFilters  The sub-filters to AND together
024:             */
025:            public AndFilter(Filter[] inFilters) {
026:                fieldFilters = inFilters;
027:            }
028:
029:            /**
030:             * Create a filter that ANDs together both of the given sub-filters.
031:             * 
032:             * @param inFilter1 The first sub-filter
033:             * @param inFilter2 The second sub-filter
034:             */
035:            public AndFilter(Filter inFilter1, Filter inFilter2) {
036:                fieldFilters = new Filter[] { inFilter1, inFilter2 };
037:            }
038:
039:            /**
040:             * Retrieve this filter's sub-filters.
041:             *
042:             * @return  This filter's sub-filters
043:             */
044:            public Filter[] getFilters() {
045:                return fieldFilters;
046:            }
047:
048:            /**
049:             * Set this filter's sub-filters.
050:             * 
051:             * @param newFilters  The new sub-filters
052:             */
053:            public void setFilters(Filter[] newFilters) {
054:                fieldFilters = newFilters;
055:            }
056:
057:            /**
058:             * Determine whether the given object passes this filter by ANDing together
059:             * all the sub-filters.
060:             *
061:             * @param inObj  The object to check
062:             *
063:             * @return <code>true</code> if the object passes all of the sub-filters,
064:             * <code>false</code> otherwise.
065:             */
066:            public boolean passes(Object inObj) throws FilterException {
067:                for (int i = 0; i < fieldFilters.length; i++) {
068:                    if (!fieldFilters[i].passes(inObj)) {
069:                        return false;
070:                    }
071:                }
072:
073:                return true;
074:            }
075:
076:            /* (non-Javadoc)
077:             * @see com.openedit.util.strainer.Filter#accept(com.openedit.util.strainer.FilterVisitor)
078:             */
079:            public void accept(FilterVisitor inFilterVisitor)
080:                    throws FilterException {
081:                if (inFilterVisitor instanceof  AndFilterVisitor) {
082:                    ((AndFilterVisitor) inFilterVisitor).visitAndFilter(this );
083:                }
084:            }
085:
086:            /* (non-Javadoc)
087:             * @see java.lang.Object#toString()
088:             */
089:            public String toString() {
090:                StringBuffer buffer = new StringBuffer();
091:                Filter[] filters = getFilters();
092:                for (int i = 0; i < filters.length; i++) {
093:                    if (i > 0) {
094:                        buffer.append(" and ");
095:                    }
096:                    buffer.append("(");
097:                    buffer.append(filters[i].toString());
098:                    buffer.append(")");
099:                }
100:                return buffer.toString();
101:            }
102:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.