EclipseJDT Source Viewer

Home|eclipse_jdt/src/org/eclipse/jdt/core/dom/BlockComment.java
1/*******************************************************************************
2 * Copyright (c) 2004, 2013 IBM Corporation and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 *     IBM Corporation - initial API and implementation
13 *******************************************************************************/
14package org.eclipse.jdt.core.dom;
15
16import java.util.ArrayList;
17import java.util.List;
18
19/**
20 * Block comment AST node type.
21 * <p>
22 * Block comments (also called "traditional" comments in JLS 3.7)
23 * begin with "/&#42;", may contain line breaks, and must end
24 * with "&#42;/". Following the definition in the JLS (first edition
25 * but not second edition), block comment normally exclude comments
26 * that begin with "/&#42;#42;", which are instead classified as doc
27 * comments ({@link Javadoc}).
28 * </p>
29 * <p>
30 * Note that this node type is a comment placeholder, and is
31 * only useful for recording the source range where a comment
32 * was found in a source string. It is not useful for creating
33 * comments.
34 * </p>
35 *
36 * @since 3.0
37 * @noinstantiate This class is not intended to be instantiated by clients.
38 */
39@SuppressWarnings("rawtypes")
40public final class BlockComment extends Comment {
41
42    /**
43     * A list of property descriptors (element type:
44     * {@link StructuralPropertyDescriptor}),
45     * or null if uninitialized.
46     */
47    private static final List PROPERTY_DESCRIPTORS;
48
49    static {
50        List properyList = new ArrayList(1);
51        createPropertyList(BlockComment.classproperyList);
52        PROPERTY_DESCRIPTORS = reapPropertyList(properyList);
53    }
54
55    /**
56     * Returns a list of structural property descriptors for this node type.
57     * Clients must not modify the result.
58     *
59     * @param apiLevel the API level; one of the
60     * <code>AST.JLS*</code> constants
61
62     * @return a list of property descriptors (element type:
63     * {@link StructuralPropertyDescriptor})
64     * @since 3.0
65     */
66    public static List propertyDescriptors(int apiLevel) {
67        return PROPERTY_DESCRIPTORS;
68    }
69
70    /**
71     * Creates a new block comment node owned by the given AST.
72     * <p>
73     * N.B. This constructor is package-private.
74     * </p>
75     *
76     * @param ast the AST that is to own this node
77     */
78    BlockComment(AST ast) {
79        super(ast);
80    }
81
82    @Override
83    final List internalStructuralPropertiesForType(int apiLevel) {
84        return propertyDescriptors(apiLevel);
85    }
86
87    @Override
88    final int getNodeType0() {
89        return BLOCK_COMMENT;
90    }
91
92    @Override
93    ASTNode clone0(AST target) {
94        BlockComment result = new BlockComment(target);
95        result.setSourceRange(getStartPosition(), getLength());
96        return result;
97    }
98
99    @Override
100    final boolean subtreeMatch0(ASTMatcher matcherObject other) {
101        // dispatch to correct overloaded match method
102        return matcher.match(this, other);
103    }
104
105    @Override
106    void accept0(ASTVisitor visitor) {
107        visitor.visit(this);
108        visitor.endVisit(this);
109    }
110
111    @Override
112    int memSize() {
113        return super.memSize();
114    }
115
116    @Override
117    int treeSize() {
118        return memSize();
119    }
120}
121
MembersX
BlockComment:propertyDescriptors
BlockComment:Block:properyList
BlockComment:getNodeType0
BlockComment:accept0
BlockComment:treeSize
BlockComment:BlockComment
BlockComment:internalStructuralPropertiesForType
BlockComment:clone0
BlockComment:memSize
BlockComment:PROPERTY_DESCRIPTORS
BlockComment:clone0:Block:result
BlockComment:subtreeMatch0
Members
X