Source Code Cross Referenced for OperatorTypes.java in  » J2EE » Mdarad » org » mdarad » framework » expr » 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 » J2EE » Mdarad » org.mdarad.framework.expr 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:            Mdarad-Toolobox is a collection of tools for Architected RAD
003:            (Rapid Application Development) based on an MDA approach.
004:            The toolbox contains frameworks and generators for many environments
005:            (JAVA, J2EE, Hibernate, .NET, C++, etc.) which allow to generate
006:            applications from a design Model
007:            Copyright (C) 2004-2005  Elapse Technologies Inc.
008:
009:            This library is free software; you can redistribute it and/or
010:            modify it under the terms of the GNU General Public
011:            License as published by the Free Software Foundation; either
012:            version 2.1 of the License, or (at your option) any later version.
013:
014:            This library is distributed in the hope that it will be useful,
015:            but WITHOUT ANY WARRANTY; without even the implied warranty of
016:            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:            General Public License for more details.
018:
019:            You should have received a copy of the GNU General Public
020:            License along with this library; if not, write to the Free Software
021:            Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
022:         */
023:        package org.mdarad.framework.expr;
024:
025:        import java.util.Collection;
026:        import java.util.Hashtable;
027:        import java.util.Iterator;
028:        import java.util.Locale;
029:        import java.util.Map;
030:
031:        /**
032:         * This class keeps the possible values of the operator types associated
033:         * to the search criteria.
034:         *       <ul>
035:         *          <li>{@link #EQUAL Equal Operator}</li>
036:         *          <li>{@link #LOWER_THAN Lower than operator type}</li>
037:         *          <li>{@link #LOWER_THAN_OR_EQUAL Lower than or equal operator type}</li>
038:         *          <li>{@link #GREATER_THAN Greater than operator type}</li>
039:         *          <li>{@link #GREATER_THAN_OR_EQUAL Greater than or equal operator type}</li>
040:         *          <li>{@link #BOOLEAN Boolean operator type}</li>
041:         *          <li>{@link #LIKE Like operator type}</li>
042:         *          <li>{@link #START_WITH Starts with operator}</li>
043:         *          <li>{@link #END_WITH Ends with operator}</li>
044:         *       </ul>
045:         * 
046:         * @author Philippe Brouillette
047:         * @version 1.0
048:         */
049:        public class OperatorTypes {
050:
051:            /**
052:             * Map of the items contained in the enumeration class
053:             */
054:            protected static Map operatorTypes = new Hashtable();
055:
056:            //Constants
057:            /**
058:             * Equal Operator
059:             */
060:            public static OperatorType EQUAL = new OperatorType(new String(
061:                    "EQUAL"), "EQUAL");
062:            /**
063:             * Lower than operator type
064:             */
065:            public static OperatorType LOWER_THAN = new OperatorType(
066:                    new String("LOWER_THAN"), "LOWER_THAN");
067:            /**
068:             * Lower than or equal operator type
069:             */
070:            public static OperatorType LOWER_THAN_OR_EQUAL = new OperatorType(
071:                    new String("LOWER_OR_EQUAL"), "LOWER_OR_EQUAL");
072:            /**
073:             * Greater than operator type
074:             */
075:            public static OperatorType GREATER_THAN = new OperatorType(
076:                    new String("GREATER_THAN"), "GREATER_THAN");
077:            /**
078:             * Greater than or equal operator type
079:             */
080:            public static OperatorType GREATER_THAN_OR_EQUAL = new OperatorType(
081:                    new String("GREATER_THAN_OR_EQUAL"),
082:                    "GREATER_THAN_OR_EQUAL");
083:            /**
084:             * boolean operator type
085:             */
086:            public static OperatorType BOOLEAN = new OperatorType(new String(
087:                    "BOOLEAN"), "BOOLEAN");
088:            /**
089:             * Like operator type
090:             */
091:            public static OperatorType LIKE = new OperatorType(new String(
092:                    "LIKE"), "LIKE");
093:            /**
094:             * Starts with operator
095:             */
096:            public static OperatorType START_WITH = new OperatorType(
097:                    new String("START_WITH"), "START_WITH");
098:            /**
099:             * Ends with operator
100:             */
101:            public static OperatorType END_WITH = new OperatorType(new String(
102:                    "END_WITH"), "END_WITH");
103:            /**
104:             * In operator
105:             */
106:            public static OperatorType IN = new OperatorType(new String("IN"),
107:                    "IN");
108:
109:            // add the constants to the enumeration
110:            static {
111:                add(EQUAL);
112:                add(LOWER_THAN);
113:                add(GREATER_THAN);
114:                add(LOWER_THAN_OR_EQUAL);
115:                add(GREATER_THAN_OR_EQUAL);
116:                add(BOOLEAN);
117:
118:            }
119:
120:            /**
121:             * Method that adds an OperatorType to this map
122:             * @param allowable OperatorType that must be added
123:             *                  to the map
124:             */
125:            protected static final void add(OperatorType allowable) {
126:                operatorTypes.put(allowable.getValue(), allowable);
127:            }
128:
129:            /**
130:             * This method returns the Operator
131:             * item associated to the value passed as argument.
132:             * If the item associated to the value doesn't exist,
133:             * the method returns <code>null</code>
134:             * @param value key of the item to get
135:             * @return Operator that is associated to the
136:             *         key passed as argument
137:             */
138:            public static OperatorType getAllowableOperators(String value) {
139:                // if the property value is null, return a null value
140:                if (value == null) {
141:                    return null;
142:                }
143:
144:                // get the allowable item
145:                OperatorType allowable = (OperatorType) operatorTypes
146:                        .get(value);
147:
148:                // catch the exception, if the value is null
149:                if (allowable == null) {
150:                    throw new IllegalStateException("Code:" + value);
151:                }
152:
153:                return allowable;
154:            }
155:
156:            /**
157:             * Method that returns an array of the
158:             * labels of the enumeration
159:             * @return  Array of strings with the labels
160:             *          of the enumeration
161:             */
162:            public static String[] getAllowableLabels(Locale locale) {
163:                // ensure the locale is valid
164:                if (locale == null)
165:                    throw new IllegalArgumentException(
166:                            "The locale object must not be null to retreive the labels");
167:
168:                // variables declaration
169:                String[] labels = new String[operatorTypes.size()];
170:                int i = 0;
171:                Iterator iterator = operatorTypes.values().iterator();
172:                // iterate through the items of the enumeration
173:                // and get the labels of the items
174:                while (iterator.hasNext()) {
175:                    OperatorType allowable = (OperatorType) iterator.next();
176:                    labels[i++] = allowable.getLabel(); //allowable.getResource(locale);
177:                }
178:                return labels;
179:            }
180:
181:            /**
182:             * Method that returns a collection of the
183:             * values of the enumeration
184:             * @return  Collection object with the values
185:             *          of the enumeration
186:             */
187:            public static Collection getAllowableValues() {
188:                return operatorTypes.keySet();
189:            }
190:
191:            /**
192:             * Method that returns all the values as a string.
193:             * @return the values of the allowable code
194:             */
195:            public String toString() {
196:                return operatorTypes.toString();
197:            }
198:
199:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.