Source Code Cross Referenced for ConstantsManager.java in  » Database-DBMS » Ozone-1.1 » org » infozone » tools » janalyzer » 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 » Database DBMS » Ozone 1.1 » org.infozone.tools.janalyzer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // You can redistribute this software and/or modify it under the terms of
002:        // the Infozone Software License version 2 published by the Infozone Group
003:        // (http://www.infozone-group.org).
004:        //
005:        // Copyright (C) @year@ by The Infozone Group. All rights reserved.
006:        //
007:        // $Id: ConstantsManager.java,v 1.1 2002/05/10 08:59:12 per_nyfelt Exp $
008:
009:        package org.infozone.tools.janalyzer;
010:
011:        /** All available Expressions and Nodes of the syntax tree */
012:        import koala.dynamicjava.tree.*;
013:
014:        /** For all available Modifier strings. */
015:        import java.lang.reflect.Modifier;
016:
017:        /**
018:         * This class returns String Constants for Binary Expressions,
019:         * Access Modifier and so on.
020:         * It's used by the JavaCodeAnalyzer class in this package.
021:         *
022:         * @version $Revision: 1.1 $ $Date: 2002/05/10 08:59:12 $
023:         * @author <a href="http://www.softwarebuero.de">SMB</a>
024:         * @see org.infozone.janalyzer.JavaCodeAnalyzer for details
025:         */
026:        public final class ConstantsManager extends java.lang.Object {
027:
028:            public static String getBinaryExpressionString(Expression aExp) {
029:                if (aExp instanceof  AddExpression) {
030:                    return "+";
031:                }
032:                if (aExp instanceof  AddAssignExpression) {
033:                    return "+=";
034:                }
035:                if (aExp instanceof  BitAndAssignExpression) {
036:                    return "&=";
037:                }
038:                if (aExp instanceof  BitOrAssignExpression) {
039:                    return "|=";
040:                }
041:                if (aExp instanceof  DivideAssignExpression) {
042:                    return "/=";
043:                }
044:                if (aExp instanceof  ExclusiveOrAssignExpression) {
045:                    return "^=";
046:                }
047:                if (aExp instanceof  MultiplyAssignExpression) {
048:                    return "*=";
049:                }
050:                if (aExp instanceof  RemainderExpression) {
051:                    return "%";
052:                }
053:                if (aExp instanceof  RemainderAssignExpression) {
054:                    return "%=";
055:                }
056:                if (aExp instanceof  ShiftLeftAssignExpression) {
057:                    return ">>=";
058:                }
059:                if (aExp instanceof  ShiftRightAssignExpression) {
060:                    return "<<=";
061:                }
062:                if (aExp instanceof  SimpleAssignExpression) {
063:                    return "=";
064:                }
065:                if (aExp instanceof  SubtractAssignExpression) {
066:                    return "-=";
067:                }
068:                if (aExp instanceof  UnsignedShiftRightAssignExpression) {
069:                    return ">>>=";
070:                }
071:                if (aExp instanceof  AndExpression) {
072:                    return "&&";
073:                }
074:                if (aExp instanceof  BitAndExpression) {
075:                    return "&";
076:                }
077:                if (aExp instanceof  BitOrExpression) {
078:                    return "|";
079:                }
080:                if (aExp instanceof  DivideExpression) {
081:                    return "/";
082:                }
083:                if (aExp instanceof  EqualExpression) {
084:                    return "==";
085:                }
086:                if (aExp instanceof  ExclusiveOrExpression) {
087:                    return "^";
088:                }
089:                if (aExp instanceof  GreaterExpression) {
090:                    return ">";
091:                }
092:                if (aExp instanceof  GreaterOrEqualExpression) {
093:                    return ">=";
094:                }
095:                if (aExp instanceof  LessExpression) {
096:                    return "<";
097:                }
098:                if (aExp instanceof  LessOrEqualExpression) {
099:                    return "<=";
100:                }
101:                if (aExp instanceof  MultiplyExpression) {
102:                    return "*";
103:                }
104:                if (aExp instanceof  NotEqualExpression) {
105:                    return "!=";
106:                }
107:                if (aExp instanceof  OrExpression) {
108:                    return "||";
109:                }
110:                if (aExp instanceof  ShiftLeftExpression) {
111:                    return "<<";
112:                }
113:                if (aExp instanceof  ShiftRightExpression) {
114:                    return ">>";
115:                }
116:                if (aExp instanceof  SimpleAssignExpression) {
117:                    return "=";
118:                }
119:                if (aExp instanceof  SubtractExpression) {
120:                    return "-";
121:                }
122:                if (aExp instanceof  UnsignedShiftRightExpression) {
123:                    return ">>>";
124:                }
125:                return "Constants Manager: unknown BinaryExpressionString "
126:                        + aExp;
127:            }
128:
129:            /**
130:             * The right operator Precedence of all conditional operators in binary expressions.
131:             * @see package koala.dynamicjava.tree
132:             * @return A int value of the level.
133:             *
134:             */
135:            public static int getExpressionLevel(Expression aExp) {
136:                if (aExp instanceof  AddAssignExpression
137:                        || aExp instanceof  BitAndAssignExpression
138:                        || aExp instanceof  BitOrAssignExpression
139:                        || aExp instanceof  DivideAssignExpression
140:                        || aExp instanceof  ExclusiveOrAssignExpression
141:                        || aExp instanceof  MultiplyAssignExpression
142:                        || aExp instanceof  RemainderAssignExpression
143:                        || aExp instanceof  ShiftLeftAssignExpression
144:                        || aExp instanceof  ShiftRightAssignExpression
145:                        || aExp instanceof  SimpleAssignExpression
146:                        || aExp instanceof  SubtractAssignExpression
147:                        || aExp instanceof  UnsignedShiftRightAssignExpression) {
148:                    return 1;
149:                }
150:                if (aExp instanceof  ConditionalExpression) {
151:                    return 2;
152:                }
153:                if (aExp instanceof  OrExpression) {
154:                    return 3;
155:                }
156:                if (aExp instanceof  AndExpression) {
157:                    return 4;
158:                }
159:                if (aExp instanceof  BitOrExpression) {
160:                    return 5;
161:                }
162:                if (aExp instanceof  ExclusiveOrExpression) {
163:                    return 6;
164:                }
165:                if (aExp instanceof  BitAndExpression) {
166:                    return 7;
167:                }
168:                if (aExp instanceof  EqualExpression
169:                        || aExp instanceof  NotEqualExpression) {
170:                    return 8;
171:                }
172:                if (aExp instanceof  GreaterExpression
173:                        || aExp instanceof  GreaterOrEqualExpression
174:                        || aExp instanceof  LessExpression
175:                        || aExp instanceof  LessOrEqualExpression
176:                        || aExp instanceof  InstanceOfExpression) {
177:                    return 9;
178:                }
179:                if (aExp instanceof  ShiftLeftExpression
180:                        || aExp instanceof  ShiftRightExpression
181:                        || aExp instanceof  UnsignedShiftRightExpression) {
182:                    return 10;
183:                }
184:                if (aExp instanceof  AddExpression
185:                        || aExp instanceof  SubtractExpression) {
186:                    return 11;
187:                }
188:                if (aExp instanceof  DivideExpression
189:                        || aExp instanceof  RemainderExpression
190:                        || aExp instanceof  MultiplyExpression) {
191:                    return 12;
192:                }
193:                if (aExp instanceof  CastExpression) {
194:                    return 13;
195:                }
196:                if (aExp instanceof  NotExpression
197:                        || aExp instanceof  PreDecrement
198:                        || aExp instanceof  PreIncrement
199:                        || aExp instanceof  PlusExpression
200:                        || aExp instanceof  MinusExpression) {
201:                    return 14;
202:                }
203:                if (aExp instanceof  PostDecrement
204:                        || aExp instanceof  PostIncrement
205:                        || aExp instanceof  ObjectMethodCall
206:                        || aExp instanceof  ObjectFieldAccess
207:                        || aExp instanceof  ArrayAccess
208:                        || aExp instanceof  CastExpression) {
209:                    return 15;
210:                }
211:                // literals should not be in parenthesis
212:                //printDB("ConstantsManager Expression " + aExp
213:                //        + " not found return level 16");
214:                return 16;
215:            }
216:
217:            /**
218:             * All avaliable modifiers of the JAVA Language.
219:             * @see java.lang.reflect.Modifier
220:             * @return A String representation of all suitable modifier or
221:             *                  an empty string.
222:             *
223:             */
224:            public static String getModifierString(int access) {
225:                String ret = "";
226:                if ((Modifier.PRIVATE & access) == Modifier.PRIVATE) {
227:                    ret += "private ";
228:                }
229:                if ((Modifier.PROTECTED & access) == Modifier.PROTECTED) {
230:                    ret += "protected ";
231:                }
232:                if ((Modifier.PUBLIC & access) == Modifier.PUBLIC) {
233:                    ret += "public ";
234:                }
235:                if ((Modifier.SYNCHRONIZED & access) == Modifier.SYNCHRONIZED) {
236:                    ret += "synchronized ";
237:                }
238:                if ((Modifier.ABSTRACT & access) == Modifier.ABSTRACT) {
239:                    ret += "abstract ";
240:                }
241:                if ((Modifier.FINAL & access) == Modifier.FINAL) {
242:                    ret += "final ";
243:                }
244:                if ((Modifier.INTERFACE & access) == Modifier.INTERFACE) {
245:                    ret += "interface ";
246:                }
247:                if ((Modifier.NATIVE & access) == Modifier.NATIVE) {
248:                    ret += "native ";
249:                }
250:                if ((Modifier.STATIC & access) == Modifier.STATIC) {
251:                    ret += "static ";
252:                }
253:                if ((Modifier.STRICT & access) == Modifier.STRICT) {
254:                    ret += "strict ";
255:                }
256:                if ((Modifier.TRANSIENT & access) == Modifier.TRANSIENT) {
257:                    ret += "transient ";
258:                }
259:                if ((Modifier.VOLATILE & access) == Modifier.VOLATILE) {
260:                    ret += "volatile ";
261:                }
262:                /*
263:                if (ret.length()>1) {
264:                	return ret.substring(0, ret.length()-1);
265:                 }    
266:                 */
267:                return ret;
268:            }
269:
270:            public static void printDB(String aLine) {
271:                System.err.println(aLine);
272:                getBinaryExpressionString(null).length();
273:            }
274:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.