Source Code Cross Referenced for Expression.java in  » UML » AndroMDA-3.2 » org » andromda » core » translation » 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 » UML » AndroMDA 3.2 » org.andromda.core.translation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.andromda.core.translation;
002:
003:        import org.andromda.core.common.ExceptionUtils;
004:        import org.apache.commons.lang.StringUtils;
005:        import org.apache.commons.lang.builder.ToStringBuilder;
006:
007:        /**
008:         * Stores the translated expression,
009:         *
010:         * @author Chad Brandon
011:         */
012:        public class Expression {
013:            /**
014:             * The resulting translated expression.
015:             */
016:            private StringBuffer translatedExpression;
017:
018:            /**
019:             * Creates a new instance of this Expression object
020:             *
021:             * @param originalExpression the expression that will be translated.
022:             */
023:            public Expression(final String originalExpression) {
024:                ExceptionUtils.checkEmpty("originalExpression",
025:                        originalExpression);
026:                this .originalExpression = StringUtils
027:                        .trimToEmpty(originalExpression);
028:                this .translatedExpression = new StringBuffer();
029:            }
030:
031:            /**
032:             * Appends the value of the value of the <code>object</code>'s toString result to the current translated expression
033:             * String Buffer.
034:             *
035:             * @param object the object to append.
036:             */
037:            public void appendToTranslatedExpression(final Object object) {
038:                this .translatedExpression.append(object);
039:            }
040:
041:            /**
042:             * Appends a space charater to the current translated expression String Buffer.
043:             */
044:            public void appendSpaceToTranslatedExpression() {
045:                this .translatedExpression.append(' ');
046:            }
047:
048:            /**
049:             * Replaces the regular expressoin <code>pattern</code> with the replacement within the translated expression
050:             * buffer.
051:             *
052:             * @param pattern     the regular expression pattern to replace
053:             * @param replacement the replacement string.
054:             */
055:            public void replaceInTranslatedExpression(final String pattern,
056:                    final String replacement) {
057:                this .translatedExpression = new StringBuffer(this 
058:                        .getTranslatedExpression().replaceAll(pattern,
059:                                replacement));
060:            }
061:
062:            /**
063:             * Performs replacement of the value of the <code>object</code>'s toString result at the start and end positions of
064:             * the buffer containing the Expression.
065:             *
066:             * @param position the position at which to insert
067:             * @param object   the
068:             * @see java.lang.StringBuffer#insert(int,java.lang.String)
069:             */
070:            public void insertInTranslatedExpression(final int position,
071:                    final Object object) {
072:                this .translatedExpression.insert(position, object);
073:            }
074:
075:            /**
076:             * Returns the expression after translation.
077:             *
078:             * @return String
079:             */
080:            public String getTranslatedExpression() {
081:                return TranslationUtils
082:                        .removeExtraWhitespace(this .translatedExpression
083:                                .toString());
084:            }
085:
086:            /**
087:             * The original expression before translation
088:             */
089:            private String originalExpression;
090:
091:            /**
092:             * Returns the expression before translation.
093:             *
094:             * @return String
095:             */
096:            public String getOriginalExpression() {
097:                return TranslationUtils
098:                        .removeExtraWhitespace(this .originalExpression);
099:            }
100:
101:            /**
102:             * The element to which the expression applies.
103:             */
104:            private String contextElement;
105:
106:            /**
107:             * Returns the element which is the context of this expression.
108:             *
109:             * @return String the context element element.
110:             */
111:            public String getContextElement() {
112:                final String methodName = "Expression.getContextElement";
113:                if (this .contextElement == null) {
114:                    throw new ExpressionException(methodName
115:                            + " - contextElement can not be null");
116:                }
117:                return this .contextElement;
118:            }
119:
120:            /**
121:             * The kind of the expression that was translated.
122:             */
123:            private String kind;
124:
125:            /**
126:             * Returns the Kind of this Expression (inv, post, or pre)
127:             *
128:             * @return String returns the Kind of this translation
129:             */
130:            public String getKind() {
131:                final String methodName = "Expression.getKind";
132:                if (this .contextElement == null) {
133:                    throw new ExpressionException(methodName
134:                            + " - kind can not be null");
135:                }
136:                return this .kind;
137:            }
138:
139:            /**
140:             * The name of the expression.
141:             */
142:            private String name;
143:
144:            /**
145:             * Gets the name of the expression.
146:             *
147:             * @return String
148:             */
149:            public String getName() {
150:                return name;
151:            }
152:
153:            /**
154:             * Sets the name.
155:             *
156:             * @param name the name to set.
157:             */
158:            public void setName(final String name) {
159:                this .name = name;
160:            }
161:
162:            /**
163:             * Sets the context element (the element to which the expression applies --> the element declared after the
164:             * <code>context</code>)
165:             *
166:             * @param contextElement the name of the element which is the context element.
167:             */
168:            public void setContextElement(final String contextElement) {
169:                this .contextElement = contextElement;
170:            }
171:
172:            /**
173:             * Sets the "kind" of the expression (i.e, "pre", "post", "inv", etc.)
174:             *
175:             * @param kind the kind to set.
176:             */
177:            public void setKind(final String kind) {
178:                this .kind = kind;
179:            }
180:
181:            /**
182:             * @see java.lang.Object#toString()
183:             */
184:            public String toString() {
185:                return ToStringBuilder.reflectionToString(this);
186:            }
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.