| 1 | /******************************************************************************* |
|---|---|
| 2 | * Copyright (c) 2021 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 | * Case Default Literal Pattern node. |
| 22 | * |
| 23 | * @since 3.27 |
| 24 | * @noreference This class is not intended to be referenced by clients. |
| 25 | * @noinstantiate This class is not intended to be instantiated by clients. |
| 26 | */ |
| 27 | @SuppressWarnings("rawtypes") |
| 28 | public class CaseDefaultExpression extends Expression { |
| 29 | |
| 30 | /** |
| 31 | * A list of property descriptors (element type: |
| 32 | * {@link StructuralPropertyDescriptor}), |
| 33 | * or null if uninitialized. |
| 34 | */ |
| 35 | private static final List PROPERTY_DESCRIPTORS; |
| 36 | |
| 37 | static { |
| 38 | List propertyList = new ArrayList(1); |
| 39 | createPropertyList(CaseDefaultExpression.class, propertyList); |
| 40 | PROPERTY_DESCRIPTORS = reapPropertyList(propertyList); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Returns a list of structural property descriptors for this node type. |
| 45 | * Clients must not modify the result. |
| 46 | * |
| 47 | * @param apiLevel the API level; one of the |
| 48 | * <code>AST.JLS*</code> constants |
| 49 | |
| 50 | * @return a list of property descriptors (element type: |
| 51 | * {@link StructuralPropertyDescriptor}) |
| 52 | */ |
| 53 | public static List propertyDescriptors(int apiLevel) { |
| 54 | return PROPERTY_DESCRIPTORS; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Creates a new unparented null literal node owned by the given AST. |
| 59 | * <p> |
| 60 | * N.B. This constructor is package-private. |
| 61 | * </p> |
| 62 | * |
| 63 | * @param ast the AST that is to own this node |
| 64 | */ |
| 65 | CaseDefaultExpression(AST ast) { |
| 66 | super(ast); |
| 67 | } |
| 68 | |
| 69 | @Override |
| 70 | final List internalStructuralPropertiesForType(int apiLevel) { |
| 71 | return propertyDescriptors(apiLevel); |
| 72 | } |
| 73 | |
| 74 | @Override |
| 75 | final int getNodeType0() { |
| 76 | return CASE_DEFAULT_EXPRESSION; |
| 77 | } |
| 78 | |
| 79 | @Override |
| 80 | ASTNode clone0(AST target) { |
| 81 | CaseDefaultExpression result = new CaseDefaultExpression(target); |
| 82 | result.setSourceRange(getStartPosition(), getLength()); |
| 83 | return result; |
| 84 | } |
| 85 | |
| 86 | @Override |
| 87 | final boolean subtreeMatch0(ASTMatcher matcher, Object other) { |
| 88 | // dispatch to correct overloaded match method |
| 89 | return matcher.match(this, other); |
| 90 | } |
| 91 | |
| 92 | @Override |
| 93 | void accept0(ASTVisitor visitor) { |
| 94 | visitor.visit(this); |
| 95 | visitor.endVisit(this); |
| 96 | } |
| 97 | |
| 98 | @Override |
| 99 | int memSize() { |
| 100 | return BASE_NODE_SIZE; |
| 101 | } |
| 102 | |
| 103 | @Override |
| 104 | int treeSize() { |
| 105 | return memSize(); |
| 106 | } |
| 107 | |
| 108 | } |
| 109 | |
| 110 |
Members