001: /*******************************************************************************
002: * Copyright (c) 2000, 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: * Null statement AST node type.
017: *
018: * <pre>
019: * EmptyStatement:
020: * <b>;</b>
021: * </pre>
022: *
023: * @since 2.0
024: */
025: public class EmptyStatement extends Statement {
026:
027: /**
028: * A list of property descriptors (element type:
029: * {@link StructuralPropertyDescriptor}),
030: * or null if uninitialized.
031: */
032: private static final List PROPERTY_DESCRIPTORS;
033:
034: static {
035: List properyList = new ArrayList(1);
036: createPropertyList(EmptyStatement.class, properyList);
037: PROPERTY_DESCRIPTORS = reapPropertyList(properyList);
038: }
039:
040: /**
041: * Returns a list of structural property descriptors for this node type.
042: * Clients must not modify the result.
043: *
044: * @param apiLevel the API level; one of the
045: * <code>AST.JLS*</code> constants
046:
047: * @return a list of property descriptors (element type:
048: * {@link StructuralPropertyDescriptor})
049: * @since 3.0
050: */
051: public static List propertyDescriptors(int apiLevel) {
052: return PROPERTY_DESCRIPTORS;
053: }
054:
055: /**
056: * Creates a new unparented null statement node owned by the given AST.
057: * <p>
058: * N.B. This constructor is package-private.
059: * </p>
060: *
061: * @param ast the AST that is to own this node
062: */
063: EmptyStatement(AST ast) {
064: super (ast);
065: }
066:
067: /* (omit javadoc for this method)
068: * Method declared on ASTNode.
069: */
070: final List internalStructuralPropertiesForType(int apiLevel) {
071: return propertyDescriptors(apiLevel);
072: }
073:
074: /* (omit javadoc for this method)
075: * Method declared on ASTNode.
076: */
077: final int getNodeType0() {
078: return EMPTY_STATEMENT;
079: }
080:
081: /* (omit javadoc for this method)
082: * Method declared on ASTNode.
083: */
084: ASTNode clone0(AST target) {
085: EmptyStatement result = new EmptyStatement(target);
086: result
087: .setSourceRange(this .getStartPosition(), this
088: .getLength());
089: result.copyLeadingComment(this );
090: return result;
091: }
092:
093: /* (omit javadoc for this method)
094: * Method declared on ASTNode.
095: */
096: final boolean subtreeMatch0(ASTMatcher matcher, Object other) {
097: // dispatch to correct overloaded match method
098: return matcher.match(this , other);
099: }
100:
101: /* (omit javadoc for this method)
102: * Method declared on ASTNode.
103: */
104: void accept0(ASTVisitor visitor) {
105: visitor.visit(this );
106: visitor.endVisit(this );
107: }
108:
109: /* (omit javadoc for this method)
110: * Method declared on ASTNode.
111: */
112: int treeSize() {
113: return memSize();
114: }
115: }
|