Source Code Cross Referenced for TokenizerPropertyEvent.java in  » Parser » JTopas » de » susebox » jtopas » 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 » Parser » JTopas » de.susebox.jtopas 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * TokenizerPropertyEvent.java: tokenizer property change event.
003:         *
004:         * Copyright (C) 2002 Heiko Blau
005:         *
006:         * This file belongs to the JTopas Library.
007:         * JTopas is free software; you can redistribute it and/or modify it 
008:         * under the terms of the GNU Lesser General Public License as published by the 
009:         * Free Software Foundation; either version 2.1 of the License, or (at your 
010:         * option) any later version.
011:         *
012:         * This software is distributed in the hope that it will be useful, but WITHOUT
013:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
014:         * FITNESS FOR A PARTICULAR PURPOSE. 
015:         * See the GNU Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public License along
018:         * with JTopas. If not, write to the
019:         *
020:         *   Free Software Foundation, Inc.
021:         *   59 Temple Place, Suite 330, 
022:         *   Boston, MA 02111-1307 
023:         *   USA
024:         *
025:         * or check the Internet: http://www.fsf.org
026:         *
027:         * Contact:
028:         *   email: heiko@susebox.de 
029:         */
030:
031:        package de.susebox.jtopas;
032:
033:        //-----------------------------------------------------------------------------
034:        // Imports
035:        //
036:
037:        //-----------------------------------------------------------------------------
038:        // class TokenizerPropertyEvent
039:        //
040:
041:        /**<p>
042:         * The class <code>TokenizerPropertyEvent</code> describes changes in
043:         * {@link TokenizerProperties} objects. Instances of this class are produced by
044:         * <code>TokenizerProperties</code> and passed to {@link TokenizerPropertyListener}
045:         * objects that are registered with the issuing <code>TokenizerProperties</code>
046:         * instance.
047:         *</p>
048:         *
049:         * @see     TokenizerProperties
050:         * @see     TokenizerPropertyListener
051:         * @author  Heiko Blau
052:         */
053:        public class TokenizerPropertyEvent {
054:
055:            //---------------------------------------------------------------------------
056:            // constants
057:            //
058:
059:            /**
060:             * A property has been added.
061:             */
062:            public static final byte PROPERTY_ADDED = 1;
063:
064:            /**
065:             * A property has been removed.
066:             */
067:            public static final byte PROPERTY_REMOVED = 2;
068:
069:            /**
070:             * A property has been modified.
071:             */
072:            public static final byte PROPERTY_MODIFIED = 3;
073:
074:            //---------------------------------------------------------------------------
075:            // constructors
076:            //
077:
078:            /**
079:             * The standard constructor initializes an emtpy event.
080:             */
081:            public TokenizerPropertyEvent() {
082:                this (0, null);
083:            }
084:
085:            /**
086:             * This constructor takes the type of the event and the {@link TokenizerProperty}
087:             * that changed.
088:             *
089:             * @param type        type of the event, one of the <code>PROPERTY_...</code> constants
090:             * @param property    the property that was added, removed or the new value of a modified one
091:             */
092:            public TokenizerPropertyEvent(int type, TokenizerProperty property) {
093:                setType(type);
094:                setProperty(property);
095:                setOldProperty(null);
096:            }
097:
098:            /**
099:             * This constructor takes the type of the event and the {@link TokenizerProperty}
100:             * that changed together with its old value.
101:             *
102:             * @param type        type of the event, one of the <code>PROPERTY_...</code> constants
103:             * @param property    the property that was added, removed or the new value of a modified one
104:             * @param oldProperty the old value of the property that modified
105:             */
106:            public TokenizerPropertyEvent(int type, TokenizerProperty property,
107:                    TokenizerProperty oldProperty) {
108:                setType(type);
109:                setProperty(property);
110:                setOldProperty(null);
111:            }
112:
113:            //---------------------------------------------------------------------------
114:            // getter and setter methods
115:            //
116:
117:            /**
118:             * Setting the event type. Use one of the <code>PROPERTY_...</code> constants
119:             * for the parameter.
120:             *
121:             * @param type  the event type
122:             * @see   #getType
123:             * @see   #PROPERTY_ADDED
124:             * @see   #PROPERTY_REMOVED
125:             * @see   #PROPERTY_MODIFIED
126:             */
127:            public void setType(int type) {
128:                _type = type;
129:            }
130:
131:            /**
132:             * Retrieving the event type. This will usually be one of the <code>PROPERTY_...</code>
133:             * constants.
134:             *
135:             * @return  the type of the event
136:             */
137:            public int getType() {
138:                return _type;
139:            }
140:
141:            /**
142:             * Setting the {@link TokenizerProperty} the event is about.
143:             *
144:             * @param property  the added, removed or modified {@link TokenizerProperty}
145:             */
146:            public void setProperty(TokenizerProperty property) {
147:                _property = property;
148:            }
149:
150:            /**
151:             * Retrieving the property this event is reporting.
152:             *
153:             * @return the {@link TokenizerProperty} that is added, removed or modified
154:             */
155:            public TokenizerProperty getProperty() {
156:                return _property;
157:            }
158:
159:            /**
160:             * Setting the {@link TokenizerProperty} that was changed. This is a valid
161:             * method for the event {@link #PROPERTY_MODIFIED}.
162:             *
163:             * @param property  the previously set {@link TokenizerProperty}
164:             */
165:            public void setOldProperty(TokenizerProperty property) {
166:                _oldProperty = property;
167:            }
168:
169:            /**
170:             * Retrieving the property that was set before the modification. The method
171:             * returns <code>null</code> when the event is <strong>NOT</strong> {@link #PROPERTY_MODIFIED}.
172:             *
173:             * @return the {@link TokenizerProperty} set before the modification
174:             */
175:            public TokenizerProperty getOldProperty() {
176:                return _oldProperty;
177:            }
178:
179:            //---------------------------------------------------------------------------
180:            // overloaded methods
181:            //
182:
183:            /**
184:             * Redefinition of the well-known {@link java.lang.Object#equals} method.
185:             *
186:             * @param   that  compare this instance with that object
187:             * @return  <code>true</code> if the two object describe the same property,
188:             *          <code>false</code> otherwise
189:             */
190:            public boolean equals(Object that) {
191:                // primitive tests
192:                if (that == null) {
193:                    return false;
194:                } else if (that == this ) {
195:                    return true;
196:                } else if (!(that instanceof  TokenizerPropertyEvent)) {
197:                    return false;
198:                }
199:
200:                // compare contents
201:                TokenizerPropertyEvent thatEvent = (TokenizerPropertyEvent) that;
202:                TokenizerProperty thatProp = thatEvent.getProperty();
203:                TokenizerProperty thatOldProp = thatEvent.getOldProperty();
204:
205:                if (getType() == thatEvent.getType()
206:                        && (_property == thatProp || (_property != null && _property
207:                                .equals(thatProp)))
208:                        && (_oldProperty == thatOldProp || (_oldProperty != null && _oldProperty
209:                                .equals(thatOldProp)))) {
210:                    return true;
211:                } else {
212:                    return false;
213:                }
214:            }
215:
216:            /**
217:             * Redefinition of the well-known {@link java.lang.Object#toString} method.
218:             *
219:             * @return a string representation of this <code>TokenizerProperty</code>
220:             */
221:            public String toString() {
222:                StringBuffer buffer = new StringBuffer();
223:
224:                buffer.append(getClass().getName());
225:                buffer.append(": ");
226:
227:                switch (_type) {
228:                case PROPERTY_ADDED:
229:                    buffer.append("added ");
230:                    break;
231:                case PROPERTY_REMOVED:
232:                    buffer.append("removed ");
233:                    break;
234:                case PROPERTY_MODIFIED:
235:                    buffer.append("modified ");
236:                    break;
237:                default:
238:                    buffer.append("<unknown type> ");
239:                }
240:
241:                if (getProperty() != null) {
242:                    buffer.append(getProperty().toString());
243:                } else {
244:                    buffer.append("<no property>");
245:                }
246:                return buffer.toString();
247:            }
248:
249:            //---------------------------------------------------------------------------
250:            // members
251:            //
252:            private int _type = 0;
253:            private TokenizerProperty _property = null;
254:            private TokenizerProperty _oldProperty = null;
255:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.