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 * End-of-line comment AST node type.
19 * End-of-line comments begin with "//",
20 * must end with a line delimiter (as per JLS 3.7),
21 * and must not contain line breaks.
24 * Note that this node type is a comment placeholder, and is
25 * only useful for recording the source range where a comment
26 * was found in a source string. It is not useful for creating
31 * @noinstantiate This class is not intended to be instantiated by clients.
33 public final class LineComment extends Comment {
36 * A list of property descriptors (element type:
37 * {@link StructuralPropertyDescriptor}),
38 * or null if uninitialized.
40 private static final List PROPERTY_DESCRIPTORS;
43 List propertyList = new ArrayList(1);
44 createPropertyList(LineComment.class, propertyList);
45 PROPERTY_DESCRIPTORS = reapPropertyList(propertyList);
49 * Returns a list of structural property descriptors for this node type.
50 * Clients must not modify the result.
52 * @param apiLevel the API level; one of the
53 * <code>AST.JLS*</code> constants
55 * @return a list of property descriptors (element type:
56 * {@link StructuralPropertyDescriptor})
59 public static List propertyDescriptors(int apiLevel) {
60 return PROPERTY_DESCRIPTORS;
64 * Creates a new line comment node owned by the given AST.
66 * N.B. This constructor is package-private.
69 * @param ast the AST that is to own this node
71 LineComment(AST ast) {
75 /* (omit javadoc for this method)
76 * Method declared on ASTNode.
78 final List internalStructuralPropertiesForType(int apiLevel) {
79 return propertyDescriptors(apiLevel);
82 /* (omit javadoc for this method)
83 * Method declared on ASTNode.
85 final int getNodeType0() {
89 /* (omit javadoc for this method)
90 * Method declared on ASTNode.
92 ASTNode clone0(AST target) {
93 LineComment result = new LineComment(target);
94 result.setSourceRange(this.getStartPosition(), this.getLength());
98 /* (omit javadoc for this method)
99 * Method declared on ASTNode.
101 final boolean subtreeMatch0(ASTMatcher matcher, Object other) {
102 // dispatch to correct overloaded match method
103 return matcher.match(this, other);
106 /* (omit javadoc for this method)
107 * Method declared on ASTNode.
109 void accept0(ASTVisitor visitor) {
111 visitor.endVisit(this);
114 /* (omit javadoc for this method)
115 * Method declared on ASTNode.
118 return super.memSize();
121 /* (omit javadoc for this method)
122 * Method declared on ASTNode.