1 | /******************************************************************************* |
---|---|
2 | * Copyright (c) 2000, 2013 IBM Corporation and others. |
3 | * |
4 | * This program and the accompanying materials |
5 | * are made available under the terms of the Eclipse Public License 2.0 |
6 | * which accompanies this distribution, and is available at |
7 | * https://www.eclipse.org/legal/epl-2.0/ |
8 | * |
9 | * SPDX-License-Identifier: EPL-2.0 |
10 | * |
11 | * Contributors: |
12 | * IBM Corporation - initial API and implementation |
13 | *******************************************************************************/ |
14 | |
15 | package org.eclipse.jdt.core.dom; |
16 | |
17 | import java.util.ArrayList; |
18 | import java.util.List; |
19 | |
20 | /** |
21 | * Null statement AST node type. |
22 | * |
23 | * <pre> |
24 | * EmptyStatement: |
25 | * <b>;</b> |
26 | * </pre> |
27 | * |
28 | * @since 2.0 |
29 | * @noinstantiate This class is not intended to be instantiated by clients. |
30 | */ |
31 | @SuppressWarnings("rawtypes") |
32 | public class EmptyStatement extends Statement { |
33 | |
34 | /** |
35 | * A list of property descriptors (element type: |
36 | * {@link StructuralPropertyDescriptor}), |
37 | * or null if uninitialized. |
38 | */ |
39 | private static final List PROPERTY_DESCRIPTORS; |
40 | |
41 | static { |
42 | List properyList = new ArrayList(1); |
43 | createPropertyList(EmptyStatement.class, properyList); |
44 | PROPERTY_DESCRIPTORS = reapPropertyList(properyList); |
45 | } |
46 | |
47 | /** |
48 | * Returns a list of structural property descriptors for this node type. |
49 | * Clients must not modify the result. |
50 | * |
51 | * @param apiLevel the API level; one of the |
52 | * <code>AST.JLS*</code> constants |
53 | |
54 | * @return a list of property descriptors (element type: |
55 | * {@link StructuralPropertyDescriptor}) |
56 | * @since 3.0 |
57 | */ |
58 | public static List propertyDescriptors(int apiLevel) { |
59 | return PROPERTY_DESCRIPTORS; |
60 | } |
61 | |
62 | /** |
63 | * Creates a new unparented null statement node owned by the given AST. |
64 | * <p> |
65 | * N.B. This constructor is package-private. |
66 | * </p> |
67 | * |
68 | * @param ast the AST that is to own this node |
69 | */ |
70 | EmptyStatement(AST ast) { |
71 | super(ast); |
72 | } |
73 | |
74 | @Override |
75 | final List internalStructuralPropertiesForType(int apiLevel) { |
76 | return propertyDescriptors(apiLevel); |
77 | } |
78 | |
79 | @Override |
80 | final int getNodeType0() { |
81 | return EMPTY_STATEMENT; |
82 | } |
83 | |
84 | @Override |
85 | ASTNode clone0(AST target) { |
86 | EmptyStatement result = new EmptyStatement(target); |
87 | result.setSourceRange(getStartPosition(), getLength()); |
88 | result.copyLeadingComment(this); |
89 | return result; |
90 | } |
91 | |
92 | @Override |
93 | final boolean subtreeMatch0(ASTMatcher matcher, Object other) { |
94 | // dispatch to correct overloaded match method |
95 | return matcher.match(this, other); |
96 | } |
97 | |
98 | @Override |
99 | void accept0(ASTVisitor visitor) { |
100 | visitor.visit(this); |
101 | visitor.endVisit(this); |
102 | } |
103 | |
104 | @Override |
105 | int treeSize() { |
106 | return memSize(); |
107 | } |
108 | } |
109 | |
110 |
Members