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