KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > dom > BlockComment


1 /*******************************************************************************
2  * Copyright (c) 2004, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.core.dom;
12
13 import java.util.ArrayList JavaDoc;
14 import java.util.List JavaDoc;
15
16 /**
17  * Block comment AST node type.
18  * <p>
19  * Block comments (also called "traditional" comments in JLS 3.7)
20  * begin with "/&#42;", may contain line breaks, and must end
21  * with "&#42;/". Following the definition in the JLS (first edition
22  * but not second edition), block comment normally exclude comments
23  * that begin with "/&#42;#42;", which are instead classified as doc
24  * comments ({@link Javadoc}).
25  * </p>
26  * <p>
27  * Note that this node type is a comment placeholder, and is
28  * only useful for recording the source range where a comment
29  * was found in a source string. It is not useful for creating
30  * comments.
31  * </p>
32  *
33  * @since 3.0
34  */

35 public final class BlockComment extends Comment {
36     
37     /**
38      * A list of property descriptors (element type:
39      * {@link StructuralPropertyDescriptor}),
40      * or null if uninitialized.
41      */

42     private static final List JavaDoc PROPERTY_DESCRIPTORS;
43     
44     static {
45         List JavaDoc properyList = new ArrayList JavaDoc(1);
46         createPropertyList(BlockComment.class, properyList);
47         PROPERTY_DESCRIPTORS = reapPropertyList(properyList);
48     }
49
50     /**
51      * Returns a list of structural property descriptors for this node type.
52      * Clients must not modify the result.
53      *
54      * @param apiLevel the API level; one of the
55      * <code>AST.JLS*</code> constants
56
57      * @return a list of property descriptors (element type:
58      * {@link StructuralPropertyDescriptor})
59      * @since 3.0
60      */

61     public static List JavaDoc propertyDescriptors(int apiLevel) {
62         return PROPERTY_DESCRIPTORS;
63     }
64             
65     /**
66      * Creates a new block comment node owned by the given AST.
67      * <p>
68      * N.B. This constructor is package-private.
69      * </p>
70      *
71      * @param ast the AST that is to own this node
72      */

73     BlockComment(AST ast) {
74         super(ast);
75     }
76
77     /* (omit javadoc for this method)
78      * Method declared on ASTNode.
79      */

80     final List JavaDoc internalStructuralPropertiesForType(int apiLevel) {
81         return propertyDescriptors(apiLevel);
82     }
83     
84     /* (omit javadoc for this method)
85      * Method declared on ASTNode.
86      */

87     final int getNodeType0() {
88         return BLOCK_COMMENT;
89     }
90
91     /* (omit javadoc for this method)
92      * Method declared on ASTNode.
93      */

94     ASTNode clone0(AST target) {
95         BlockComment result = new BlockComment(target);
96         result.setSourceRange(this.getStartPosition(), this.getLength());
97         return result;
98     }
99
100     /* (omit javadoc for this method)
101      * Method declared on ASTNode.
102      */

103     final boolean subtreeMatch0(ASTMatcher matcher, Object JavaDoc other) {
104         // dispatch to correct overloaded match method
105
return matcher.match(this, other);
106     }
107
108     /* (omit javadoc for this method)
109      * Method declared on ASTNode.
110      */

111     void accept0(ASTVisitor visitor) {
112         visitor.visit(this);
113         visitor.endVisit(this);
114     }
115     
116     /* (omit javadoc for this method)
117      * Method declared on ASTNode.
118      */

119     int memSize() {
120         return super.memSize();
121     }
122     
123     /* (omit javadoc for this method)
124      * Method declared on ASTNode.
125      */

126     int treeSize() {
127         return memSize();
128     }
129 }
130
Popular Tags