1 /*******************************************************************************
2 * Copyright (c) 2004, 2008 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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.core.dom;
13 import java.util.ArrayList;
14 import java.util.List;
17 * Block comment AST node type.
19 * Block comments (also called "traditional" comments in JLS 3.7)
20 * begin with "/*", may contain line breaks, and must end
21 * with "*/". Following the definition in the JLS (first edition
22 * but not second edition), block comment normally exclude comments
23 * that begin with "/*#42;", which are instead classified as doc
24 * comments ({@link Javadoc}).
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
34 * @noinstantiate This class is not intended to be instantiated by clients.
36 public final class BlockComment extends Comment {
39 * A list of property descriptors (element type:
40 * {@link StructuralPropertyDescriptor}),
41 * or null if uninitialized.
43 private static final List PROPERTY_DESCRIPTORS;
46 List properyList = new ArrayList(1);
47 createPropertyList(BlockComment.class, properyList);
48 PROPERTY_DESCRIPTORS = reapPropertyList(properyList);
52 * Returns a list of structural property descriptors for this node type.
53 * Clients must not modify the result.
55 * @param apiLevel the API level; one of the
56 * <code>AST.JLS*</code> constants
58 * @return a list of property descriptors (element type:
59 * {@link StructuralPropertyDescriptor})
62 public static List propertyDescriptors(int apiLevel) {
63 return PROPERTY_DESCRIPTORS;
67 * Creates a new block comment node owned by the given AST.
69 * N.B. This constructor is package-private.
72 * @param ast the AST that is to own this node
74 BlockComment(AST ast) {
78 /* (omit javadoc for this method)
79 * Method declared on ASTNode.
81 final List internalStructuralPropertiesForType(int apiLevel) {
82 return propertyDescriptors(apiLevel);
85 /* (omit javadoc for this method)
86 * Method declared on ASTNode.
88 final int getNodeType0() {
92 /* (omit javadoc for this method)
93 * Method declared on ASTNode.
95 ASTNode clone0(AST target) {
96 BlockComment result = new BlockComment(target);
97 result.setSourceRange(this.getStartPosition(), this.getLength());
101 /* (omit javadoc for this method)
102 * Method declared on ASTNode.
104 final boolean subtreeMatch0(ASTMatcher matcher, Object other) {
105 // dispatch to correct overloaded match method
106 return matcher.match(this, other);
109 /* (omit javadoc for this method)
110 * Method declared on ASTNode.
112 void accept0(ASTVisitor visitor) {
114 visitor.endVisit(this);
117 /* (omit javadoc for this method)
118 * Method declared on ASTNode.
121 return super.memSize();
124 /* (omit javadoc for this method)
125 * Method declared on ASTNode.