Source Code Cross Referenced for SimpleType.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » core » dom » 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 » IDE Eclipse » jdt » org.eclipse.jdt.core.dom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2006 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.jdt.core.dom;
011:
012:        import java.util.ArrayList;
013:        import java.util.List;
014:
015:        /**
016:         * Type node for a named class type, a named interface type, or a type variable.
017:         * <p>
018:         * This kind of node is used to convert a name (<code>Name</code>) into a type
019:         * (<code>Type</code>) by wrapping it.
020:         * </p>
021:         * 
022:         * @since 2.0
023:         */
024:        public class SimpleType extends Type {
025:
026:            /**
027:             * The "name" structural property of this node type.
028:             * @since 3.0
029:             */
030:            public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor(
031:                    SimpleType.class,
032:                    "name", Name.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$
033:
034:            /**
035:             * A list of property descriptors (element type: 
036:             * {@link StructuralPropertyDescriptor}),
037:             * or null if uninitialized.
038:             */
039:            private static final List PROPERTY_DESCRIPTORS;
040:
041:            static {
042:                List propertyList = new ArrayList(2);
043:                createPropertyList(SimpleType.class, propertyList);
044:                addProperty(NAME_PROPERTY, propertyList);
045:                PROPERTY_DESCRIPTORS = reapPropertyList(propertyList);
046:            }
047:
048:            /**
049:             * Returns a list of structural property descriptors for this node type.
050:             * Clients must not modify the result.
051:             * 
052:             * @param apiLevel the API level; one of the
053:             * <code>AST.JLS*</code> constants
054:             * @return a list of property descriptors (element type: 
055:             * {@link StructuralPropertyDescriptor})
056:             * @since 3.0
057:             */
058:            public static List propertyDescriptors(int apiLevel) {
059:                return PROPERTY_DESCRIPTORS;
060:            }
061:
062:            /** 
063:             * The type name node; lazily initialized; defaults to a type with
064:             * an unspecfied, but legal, name.
065:             */
066:            private Name typeName = null;
067:
068:            /**
069:             * Creates a new unparented node for a simple type owned by the given AST.
070:             * By default, an unspecified, but legal, name.
071:             * <p>
072:             * N.B. This constructor is package-private.
073:             * </p>
074:             * 
075:             * @param ast the AST that is to own this node
076:             */
077:            SimpleType(AST ast) {
078:                super (ast);
079:            }
080:
081:            /* (omit javadoc for this method)
082:             * Method declared on ASTNode.
083:             */
084:            final List internalStructuralPropertiesForType(int apiLevel) {
085:                return propertyDescriptors(apiLevel);
086:            }
087:
088:            /* (omit javadoc for this method)
089:             * Method declared on ASTNode.
090:             */
091:            final ASTNode internalGetSetChildProperty(
092:                    ChildPropertyDescriptor property, boolean get, ASTNode child) {
093:                if (property == NAME_PROPERTY) {
094:                    if (get) {
095:                        return getName();
096:                    } else {
097:                        setName((Name) child);
098:                        return null;
099:                    }
100:                }
101:                // allow default implementation to flag the error
102:                return super .internalGetSetChildProperty(property, get, child);
103:            }
104:
105:            /* (omit javadoc for this method)
106:             * Method declared on ASTNode.
107:             */
108:            final int getNodeType0() {
109:                return SIMPLE_TYPE;
110:            }
111:
112:            /* (omit javadoc for this method)
113:             * Method declared on ASTNode.
114:             */
115:            ASTNode clone0(AST target) {
116:                SimpleType result = new SimpleType(target);
117:                result
118:                        .setSourceRange(this .getStartPosition(), this 
119:                                .getLength());
120:                result.setName((Name) (getName()).clone(target));
121:                return result;
122:            }
123:
124:            /* (omit javadoc for this method)
125:             * Method declared on ASTNode.
126:             */
127:            final boolean subtreeMatch0(ASTMatcher matcher, Object other) {
128:                // dispatch to correct overloaded match method
129:                return matcher.match(this , other);
130:            }
131:
132:            /* (omit javadoc for this method)
133:             * Method declared on ASTNode.
134:             */
135:            void accept0(ASTVisitor visitor) {
136:                boolean visitChildren = visitor.visit(this );
137:                if (visitChildren) {
138:                    acceptChild(visitor, getName());
139:                }
140:                visitor.endVisit(this );
141:            }
142:
143:            /**
144:             * Returns the name of this simple type.
145:             * 
146:             * @return the name of this simple type
147:             */
148:            public Name getName() {
149:                if (this .typeName == null) {
150:                    // lazy init must be thread-safe for readers
151:                    synchronized (this ) {
152:                        if (this .typeName == null) {
153:                            preLazyInit();
154:                            this .typeName = new SimpleName(this .ast);
155:                            postLazyInit(this .typeName, NAME_PROPERTY);
156:                        }
157:                    }
158:                }
159:                return this .typeName;
160:            }
161:
162:            /**
163:             * Sets the name of this simple type to the given name.
164:             * 
165:             * @param typeName the new name of this simple type
166:             * @exception IllegalArgumentException if:
167:             * <ul>
168:             * <li>the node belongs to a different AST</li>
169:             * <li>the node already has a parent</li>
170:             * </ul>
171:             */
172:            public void setName(Name typeName) {
173:                if (typeName == null) {
174:                    throw new IllegalArgumentException();
175:                }
176:                ASTNode oldChild = this .typeName;
177:                preReplaceChild(oldChild, typeName, NAME_PROPERTY);
178:                this .typeName = typeName;
179:                postReplaceChild(oldChild, typeName, NAME_PROPERTY);
180:            }
181:
182:            /* (omit javadoc for this method)
183:             * Method declared on ASTNode.
184:             */
185:            int memSize() {
186:                // treat Code as free
187:                return BASE_NODE_SIZE + 1 * 4;
188:            }
189:
190:            /* (omit javadoc for this method)
191:             * Method declared on ASTNode.
192:             */
193:            int treeSize() {
194:                return memSize()
195:                        + (this .typeName == null ? 0 : getName().treeSize());
196:            }
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.