001: /*******************************************************************************
002: * Copyright (c) 2004, 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: * Block comment AST node type.
017: * <p>
018: * Block comments (also called "traditional" comments in JLS 3.7)
019: * begin with "/*", may contain line breaks, and must end
020: * with "*/". Following the definition in the JLS (first edition
021: * but not second edition), block comment normally exclude comments
022: * that begin with "/*#42;", which are instead classified as doc
023: * comments ({@link Javadoc}).
024: * </p>
025: * <p>
026: * Note that this node type is a comment placeholder, and is
027: * only useful for recording the source range where a comment
028: * was found in a source string. It is not useful for creating
029: * comments.
030: * </p>
031: *
032: * @since 3.0
033: */
034: public final class BlockComment extends Comment {
035:
036: /**
037: * A list of property descriptors (element type:
038: * {@link StructuralPropertyDescriptor}),
039: * or null if uninitialized.
040: */
041: private static final List PROPERTY_DESCRIPTORS;
042:
043: static {
044: List properyList = new ArrayList(1);
045: createPropertyList(BlockComment.class, properyList);
046: PROPERTY_DESCRIPTORS = reapPropertyList(properyList);
047: }
048:
049: /**
050: * Returns a list of structural property descriptors for this node type.
051: * Clients must not modify the result.
052: *
053: * @param apiLevel the API level; one of the
054: * <code>AST.JLS*</code> constants
055:
056: * @return a list of property descriptors (element type:
057: * {@link StructuralPropertyDescriptor})
058: * @since 3.0
059: */
060: public static List propertyDescriptors(int apiLevel) {
061: return PROPERTY_DESCRIPTORS;
062: }
063:
064: /**
065: * Creates a new block comment node owned by the given AST.
066: * <p>
067: * N.B. This constructor is package-private.
068: * </p>
069: *
070: * @param ast the AST that is to own this node
071: */
072: BlockComment(AST ast) {
073: super (ast);
074: }
075:
076: /* (omit javadoc for this method)
077: * Method declared on ASTNode.
078: */
079: final List internalStructuralPropertiesForType(int apiLevel) {
080: return propertyDescriptors(apiLevel);
081: }
082:
083: /* (omit javadoc for this method)
084: * Method declared on ASTNode.
085: */
086: final int getNodeType0() {
087: return BLOCK_COMMENT;
088: }
089:
090: /* (omit javadoc for this method)
091: * Method declared on ASTNode.
092: */
093: ASTNode clone0(AST target) {
094: BlockComment result = new BlockComment(target);
095: result
096: .setSourceRange(this .getStartPosition(), this
097: .getLength());
098: return result;
099: }
100:
101: /* (omit javadoc for this method)
102: * Method declared on ASTNode.
103: */
104: final boolean subtreeMatch0(ASTMatcher matcher, Object other) {
105: // dispatch to correct overloaded match method
106: return matcher.match(this , other);
107: }
108:
109: /* (omit javadoc for this method)
110: * Method declared on ASTNode.
111: */
112: void accept0(ASTVisitor visitor) {
113: visitor.visit(this );
114: visitor.endVisit(this );
115: }
116:
117: /* (omit javadoc for this method)
118: * Method declared on ASTNode.
119: */
120: int memSize() {
121: return super .memSize();
122: }
123:
124: /* (omit javadoc for this method)
125: * Method declared on ASTNode.
126: */
127: int treeSize() {
128: return memSize();
129: }
130: }
|