org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Comment.java
Parent Directory
|
Revision Log
Revision 1.9 -
(download)
(annotate)
Sat Mar 7 01:08:09 2009 UTC (8 months, 3 weeks ago) by oliviert
Branch: MAIN
CVS Tags: v_943, v_942, v_974_R35x, v_969_R35x, v_A03, v_A02, v_A01, v_A00, v_A07, v_A06, v_A05, v_A04, v_A09, v_A08, v_968_R35x, v_958, v_959, v_950, v_951, v_952, v_953, v_954, v_955, v_956, v_957, v_971_R35x, v_978_R35x, v_961, v_960, v_963, v_962, v_964_R35x, v_977_R35x, R3_5, v_A18, v_A19, v_A14, v_A15, v_A16, v_A10, v_A11, v_A12, v_A13, v_966_R35x, v_970_R35x, v_A21, v_A20, v_A23, v_A22, v_975_R35x, v_976_R35x, v_967_R35x, v_965_R35x, v_A21d, v_A21a, jsr308_A22, v_972_R35x, v_949, v_948, v_947, v_946, v_945, v_944, R3_5_1, v_A17b, v_A17c, v_973_R35x, HEAD
Branch point for: JSR_308, R3_5_maintenance
Changes since 1.8: +1 -1 lines
Sat Mar 7 01:08:09 2009 UTC (8 months, 3 weeks ago) by oliviert
Branch: MAIN
CVS Tags: v_943, v_942, v_974_R35x, v_969_R35x, v_A03, v_A02, v_A01, v_A00, v_A07, v_A06, v_A05, v_A04, v_A09, v_A08, v_968_R35x, v_958, v_959, v_950, v_951, v_952, v_953, v_954, v_955, v_956, v_957, v_971_R35x, v_978_R35x, v_961, v_960, v_963, v_962, v_964_R35x, v_977_R35x, R3_5, v_A18, v_A19, v_A14, v_A15, v_A16, v_A10, v_A11, v_A12, v_A13, v_966_R35x, v_970_R35x, v_A21, v_A20, v_A23, v_A22, v_975_R35x, v_976_R35x, v_967_R35x, v_965_R35x, v_A21d, v_A21a, jsr308_A22, v_972_R35x, v_949, v_948, v_947, v_946, v_945, v_944, R3_5_1, v_A17b, v_A17c, v_973_R35x, HEAD
Branch point for: JSR_308, R3_5_maintenance
Changes since 1.8: +1 -1 lines
HEAD - Fix copyrights
/******************************************************************************* * Copyright (c) 2004, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jdt.core.dom; /** * Abstract base class for all AST nodes that represent comments. * There are exactly three kinds of comment: * line comments ({@link LineComment}), * block comments ({@link BlockComment}), and * doc comments ({@link Javadoc}). * <p> * <pre> * Comment: * LineComment * BlockComment * Javadoc * </pre> * </p> * * @since 3.0 */ public abstract class Comment extends ASTNode { /** * Alternate root node, or <code>null</code> if none. * Initially <code>null</code>. */ private ASTNode alternateRoot = null; /** * Creates a new AST node for a comment owned by the given AST. * <p> * N.B. This constructor is package-private. * </p> * * @param ast the AST that is to own this node */ Comment(AST ast) { super(ast); } /** * Returns whether this comment is a block comment * (<code>BlockComment</code>). * * @return <code>true</code> if this is a block comment, and * <code>false</code> otherwise */ public final boolean isBlockComment() { return (this instanceof BlockComment); } /** * Returns whether this comment is a line comment * (<code>LineComment</code>). * * @return <code>true</code> if this is a line comment, and * <code>false</code> otherwise */ public final boolean isLineComment() { return (this instanceof LineComment); } /** * Returns whether this comment is a doc comment * (<code>Javadoc</code>). * * @return <code>true</code> if this is a doc comment, and * <code>false</code> otherwise */ public final boolean isDocComment() { return (this instanceof Javadoc); } /** * Returns the root AST node that this comment occurs * within, or <code>null</code> if none (or not recorded). * <p> * Typically, the comment nodes created while parsing a compilation * unit are not considered descendents of the normal AST * root, namely an {@link CompilationUnit}. Instead, these * comment nodes exist outside the normal AST and each is * a root in its own right. This optional property provides * a well-known way to navigate from the comment to the * compilation unit in such cases. Note that the alternate root * property is not one of the comment node's children. It is simply a * reference to a node. * </p> * * @return the alternate root node, or <code>null</code> * if none * @see #setAlternateRoot(ASTNode) */ public final ASTNode getAlternateRoot() { return this.alternateRoot; } /** * Returns the root AST node that this comment occurs * within, or <code>null</code> if none (or not recorded). * <p> * </p> * * @param root the alternate root node, or <code>null</code> * if none * @see #getAlternateRoot() */ public final void setAlternateRoot(ASTNode root) { // alternate root is *not* considered a structural property // but we protect them nevertheless checkModifiable(); this.alternateRoot = root; } /* (omit javadoc for this method) * Method declared on ASTNode. */ int memSize() { return BASE_NODE_SIZE + 1 * 4; } }
| help@eclipse.org | ViewVC Help |
| Powered by ViewVC 1.0.3 |
