Wed, 27 Apr 2016 01:34:52 +0800
Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/langtools/
changeset: 2573:53ca196be1ae
tag: jdk8u25-b17
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | package com.sun.source.tree; |
aoqi@0 | 27 | |
aoqi@0 | 28 | /** |
aoqi@0 | 29 | * Common interface for all nodes in an abstract syntax tree. |
aoqi@0 | 30 | * |
aoqi@0 | 31 | * <p><b>WARNING:</b> This interface and its sub-interfaces are |
aoqi@0 | 32 | * subject to change as the Java™ programming language evolves. |
aoqi@0 | 33 | * These interfaces are implemented by the JDK Java compiler (javac) |
aoqi@0 | 34 | * and should not be implemented either directly or indirectly by |
aoqi@0 | 35 | * other applications. |
aoqi@0 | 36 | * |
aoqi@0 | 37 | * @author Peter von der Ahé |
aoqi@0 | 38 | * @author Jonathan Gibbons |
aoqi@0 | 39 | * |
aoqi@0 | 40 | * @since 1.6 |
aoqi@0 | 41 | */ |
aoqi@0 | 42 | @jdk.Exported |
aoqi@0 | 43 | public interface Tree { |
aoqi@0 | 44 | |
aoqi@0 | 45 | /** |
aoqi@0 | 46 | * Enumerates all kinds of trees. |
aoqi@0 | 47 | */ |
aoqi@0 | 48 | @jdk.Exported |
aoqi@0 | 49 | public enum Kind { |
aoqi@0 | 50 | |
aoqi@0 | 51 | ANNOTATED_TYPE(AnnotatedTypeTree.class), |
aoqi@0 | 52 | |
aoqi@0 | 53 | /** |
aoqi@0 | 54 | * Used for instances of {@link AnnotationTree} |
aoqi@0 | 55 | * representing declaration annotations. |
aoqi@0 | 56 | */ |
aoqi@0 | 57 | ANNOTATION(AnnotationTree.class), |
aoqi@0 | 58 | |
aoqi@0 | 59 | /** |
aoqi@0 | 60 | * Used for instances of {@link AnnotationTree} |
aoqi@0 | 61 | * representing type annotations. |
aoqi@0 | 62 | */ |
aoqi@0 | 63 | TYPE_ANNOTATION(AnnotationTree.class), |
aoqi@0 | 64 | |
aoqi@0 | 65 | /** |
aoqi@0 | 66 | * Used for instances of {@link ArrayAccessTree}. |
aoqi@0 | 67 | */ |
aoqi@0 | 68 | ARRAY_ACCESS(ArrayAccessTree.class), |
aoqi@0 | 69 | |
aoqi@0 | 70 | /** |
aoqi@0 | 71 | * Used for instances of {@link ArrayTypeTree}. |
aoqi@0 | 72 | */ |
aoqi@0 | 73 | ARRAY_TYPE(ArrayTypeTree.class), |
aoqi@0 | 74 | |
aoqi@0 | 75 | /** |
aoqi@0 | 76 | * Used for instances of {@link AssertTree}. |
aoqi@0 | 77 | */ |
aoqi@0 | 78 | ASSERT(AssertTree.class), |
aoqi@0 | 79 | |
aoqi@0 | 80 | /** |
aoqi@0 | 81 | * Used for instances of {@link AssignmentTree}. |
aoqi@0 | 82 | */ |
aoqi@0 | 83 | ASSIGNMENT(AssignmentTree.class), |
aoqi@0 | 84 | |
aoqi@0 | 85 | /** |
aoqi@0 | 86 | * Used for instances of {@link BlockTree}. |
aoqi@0 | 87 | */ |
aoqi@0 | 88 | BLOCK(BlockTree.class), |
aoqi@0 | 89 | |
aoqi@0 | 90 | /** |
aoqi@0 | 91 | * Used for instances of {@link BreakTree}. |
aoqi@0 | 92 | */ |
aoqi@0 | 93 | BREAK(BreakTree.class), |
aoqi@0 | 94 | |
aoqi@0 | 95 | /** |
aoqi@0 | 96 | * Used for instances of {@link CaseTree}. |
aoqi@0 | 97 | */ |
aoqi@0 | 98 | CASE(CaseTree.class), |
aoqi@0 | 99 | |
aoqi@0 | 100 | /** |
aoqi@0 | 101 | * Used for instances of {@link CatchTree}. |
aoqi@0 | 102 | */ |
aoqi@0 | 103 | CATCH(CatchTree.class), |
aoqi@0 | 104 | |
aoqi@0 | 105 | /** |
aoqi@0 | 106 | * Used for instances of {@link ClassTree} representing classes. |
aoqi@0 | 107 | */ |
aoqi@0 | 108 | CLASS(ClassTree.class), |
aoqi@0 | 109 | |
aoqi@0 | 110 | /** |
aoqi@0 | 111 | * Used for instances of {@link CompilationUnitTree}. |
aoqi@0 | 112 | */ |
aoqi@0 | 113 | COMPILATION_UNIT(CompilationUnitTree.class), |
aoqi@0 | 114 | |
aoqi@0 | 115 | /** |
aoqi@0 | 116 | * Used for instances of {@link ConditionalExpressionTree}. |
aoqi@0 | 117 | */ |
aoqi@0 | 118 | CONDITIONAL_EXPRESSION(ConditionalExpressionTree.class), |
aoqi@0 | 119 | |
aoqi@0 | 120 | /** |
aoqi@0 | 121 | * Used for instances of {@link ContinueTree}. |
aoqi@0 | 122 | */ |
aoqi@0 | 123 | CONTINUE(ContinueTree.class), |
aoqi@0 | 124 | |
aoqi@0 | 125 | /** |
aoqi@0 | 126 | * Used for instances of {@link DoWhileLoopTree}. |
aoqi@0 | 127 | */ |
aoqi@0 | 128 | DO_WHILE_LOOP(DoWhileLoopTree.class), |
aoqi@0 | 129 | |
aoqi@0 | 130 | /** |
aoqi@0 | 131 | * Used for instances of {@link EnhancedForLoopTree}. |
aoqi@0 | 132 | */ |
aoqi@0 | 133 | ENHANCED_FOR_LOOP(EnhancedForLoopTree.class), |
aoqi@0 | 134 | |
aoqi@0 | 135 | /** |
aoqi@0 | 136 | * Used for instances of {@link ExpressionStatementTree}. |
aoqi@0 | 137 | */ |
aoqi@0 | 138 | EXPRESSION_STATEMENT(ExpressionStatementTree.class), |
aoqi@0 | 139 | |
aoqi@0 | 140 | /** |
aoqi@0 | 141 | * Used for instances of {@link MemberSelectTree}. |
aoqi@0 | 142 | */ |
aoqi@0 | 143 | MEMBER_SELECT(MemberSelectTree.class), |
aoqi@0 | 144 | |
aoqi@0 | 145 | /** |
aoqi@0 | 146 | * Used for instances of {@link MemberReferenceTree}. |
aoqi@0 | 147 | */ |
aoqi@0 | 148 | MEMBER_REFERENCE(MemberReferenceTree.class), |
aoqi@0 | 149 | |
aoqi@0 | 150 | /** |
aoqi@0 | 151 | * Used for instances of {@link ForLoopTree}. |
aoqi@0 | 152 | */ |
aoqi@0 | 153 | FOR_LOOP(ForLoopTree.class), |
aoqi@0 | 154 | |
aoqi@0 | 155 | /** |
aoqi@0 | 156 | * Used for instances of {@link IdentifierTree}. |
aoqi@0 | 157 | */ |
aoqi@0 | 158 | IDENTIFIER(IdentifierTree.class), |
aoqi@0 | 159 | |
aoqi@0 | 160 | /** |
aoqi@0 | 161 | * Used for instances of {@link IfTree}. |
aoqi@0 | 162 | */ |
aoqi@0 | 163 | IF(IfTree.class), |
aoqi@0 | 164 | |
aoqi@0 | 165 | /** |
aoqi@0 | 166 | * Used for instances of {@link ImportTree}. |
aoqi@0 | 167 | */ |
aoqi@0 | 168 | IMPORT(ImportTree.class), |
aoqi@0 | 169 | |
aoqi@0 | 170 | /** |
aoqi@0 | 171 | * Used for instances of {@link InstanceOfTree}. |
aoqi@0 | 172 | */ |
aoqi@0 | 173 | INSTANCE_OF(InstanceOfTree.class), |
aoqi@0 | 174 | |
aoqi@0 | 175 | /** |
aoqi@0 | 176 | * Used for instances of {@link LabeledStatementTree}. |
aoqi@0 | 177 | */ |
aoqi@0 | 178 | LABELED_STATEMENT(LabeledStatementTree.class), |
aoqi@0 | 179 | |
aoqi@0 | 180 | /** |
aoqi@0 | 181 | * Used for instances of {@link MethodTree}. |
aoqi@0 | 182 | */ |
aoqi@0 | 183 | METHOD(MethodTree.class), |
aoqi@0 | 184 | |
aoqi@0 | 185 | /** |
aoqi@0 | 186 | * Used for instances of {@link MethodInvocationTree}. |
aoqi@0 | 187 | */ |
aoqi@0 | 188 | METHOD_INVOCATION(MethodInvocationTree.class), |
aoqi@0 | 189 | |
aoqi@0 | 190 | /** |
aoqi@0 | 191 | * Used for instances of {@link ModifiersTree}. |
aoqi@0 | 192 | */ |
aoqi@0 | 193 | MODIFIERS(ModifiersTree.class), |
aoqi@0 | 194 | |
aoqi@0 | 195 | /** |
aoqi@0 | 196 | * Used for instances of {@link NewArrayTree}. |
aoqi@0 | 197 | */ |
aoqi@0 | 198 | NEW_ARRAY(NewArrayTree.class), |
aoqi@0 | 199 | |
aoqi@0 | 200 | /** |
aoqi@0 | 201 | * Used for instances of {@link NewClassTree}. |
aoqi@0 | 202 | */ |
aoqi@0 | 203 | NEW_CLASS(NewClassTree.class), |
aoqi@0 | 204 | |
aoqi@0 | 205 | /** |
aoqi@0 | 206 | * Used for instances of {@link LambdaExpressionTree}. |
aoqi@0 | 207 | */ |
aoqi@0 | 208 | LAMBDA_EXPRESSION(LambdaExpressionTree.class), |
aoqi@0 | 209 | |
aoqi@0 | 210 | /** |
aoqi@0 | 211 | * Used for instances of {@link ParenthesizedTree}. |
aoqi@0 | 212 | */ |
aoqi@0 | 213 | PARENTHESIZED(ParenthesizedTree.class), |
aoqi@0 | 214 | |
aoqi@0 | 215 | /** |
aoqi@0 | 216 | * Used for instances of {@link PrimitiveTypeTree}. |
aoqi@0 | 217 | */ |
aoqi@0 | 218 | PRIMITIVE_TYPE(PrimitiveTypeTree.class), |
aoqi@0 | 219 | |
aoqi@0 | 220 | /** |
aoqi@0 | 221 | * Used for instances of {@link ReturnTree}. |
aoqi@0 | 222 | */ |
aoqi@0 | 223 | RETURN(ReturnTree.class), |
aoqi@0 | 224 | |
aoqi@0 | 225 | /** |
aoqi@0 | 226 | * Used for instances of {@link EmptyStatementTree}. |
aoqi@0 | 227 | */ |
aoqi@0 | 228 | EMPTY_STATEMENT(EmptyStatementTree.class), |
aoqi@0 | 229 | |
aoqi@0 | 230 | /** |
aoqi@0 | 231 | * Used for instances of {@link SwitchTree}. |
aoqi@0 | 232 | */ |
aoqi@0 | 233 | SWITCH(SwitchTree.class), |
aoqi@0 | 234 | |
aoqi@0 | 235 | /** |
aoqi@0 | 236 | * Used for instances of {@link SynchronizedTree}. |
aoqi@0 | 237 | */ |
aoqi@0 | 238 | SYNCHRONIZED(SynchronizedTree.class), |
aoqi@0 | 239 | |
aoqi@0 | 240 | /** |
aoqi@0 | 241 | * Used for instances of {@link ThrowTree}. |
aoqi@0 | 242 | */ |
aoqi@0 | 243 | THROW(ThrowTree.class), |
aoqi@0 | 244 | |
aoqi@0 | 245 | /** |
aoqi@0 | 246 | * Used for instances of {@link TryTree}. |
aoqi@0 | 247 | */ |
aoqi@0 | 248 | TRY(TryTree.class), |
aoqi@0 | 249 | |
aoqi@0 | 250 | /** |
aoqi@0 | 251 | * Used for instances of {@link ParameterizedTypeTree}. |
aoqi@0 | 252 | */ |
aoqi@0 | 253 | PARAMETERIZED_TYPE(ParameterizedTypeTree.class), |
aoqi@0 | 254 | |
aoqi@0 | 255 | /** |
aoqi@0 | 256 | * Used for instances of {@link UnionTypeTree}. |
aoqi@0 | 257 | */ |
aoqi@0 | 258 | UNION_TYPE(UnionTypeTree.class), |
aoqi@0 | 259 | |
aoqi@0 | 260 | /** |
aoqi@0 | 261 | * Used for instances of {@link IntersectionTypeTree}. |
aoqi@0 | 262 | */ |
aoqi@0 | 263 | INTERSECTION_TYPE(IntersectionTypeTree.class), |
aoqi@0 | 264 | |
aoqi@0 | 265 | /** |
aoqi@0 | 266 | * Used for instances of {@link TypeCastTree}. |
aoqi@0 | 267 | */ |
aoqi@0 | 268 | TYPE_CAST(TypeCastTree.class), |
aoqi@0 | 269 | |
aoqi@0 | 270 | /** |
aoqi@0 | 271 | * Used for instances of {@link TypeParameterTree}. |
aoqi@0 | 272 | */ |
aoqi@0 | 273 | TYPE_PARAMETER(TypeParameterTree.class), |
aoqi@0 | 274 | |
aoqi@0 | 275 | /** |
aoqi@0 | 276 | * Used for instances of {@link VariableTree}. |
aoqi@0 | 277 | */ |
aoqi@0 | 278 | VARIABLE(VariableTree.class), |
aoqi@0 | 279 | |
aoqi@0 | 280 | /** |
aoqi@0 | 281 | * Used for instances of {@link WhileLoopTree}. |
aoqi@0 | 282 | */ |
aoqi@0 | 283 | WHILE_LOOP(WhileLoopTree.class), |
aoqi@0 | 284 | |
aoqi@0 | 285 | /** |
aoqi@0 | 286 | * Used for instances of {@link UnaryTree} representing postfix |
aoqi@0 | 287 | * increment operator {@code ++}. |
aoqi@0 | 288 | */ |
aoqi@0 | 289 | POSTFIX_INCREMENT(UnaryTree.class), |
aoqi@0 | 290 | |
aoqi@0 | 291 | /** |
aoqi@0 | 292 | * Used for instances of {@link UnaryTree} representing postfix |
aoqi@0 | 293 | * decrement operator {@code --}. |
aoqi@0 | 294 | */ |
aoqi@0 | 295 | POSTFIX_DECREMENT(UnaryTree.class), |
aoqi@0 | 296 | |
aoqi@0 | 297 | /** |
aoqi@0 | 298 | * Used for instances of {@link UnaryTree} representing prefix |
aoqi@0 | 299 | * increment operator {@code ++}. |
aoqi@0 | 300 | */ |
aoqi@0 | 301 | PREFIX_INCREMENT(UnaryTree.class), |
aoqi@0 | 302 | |
aoqi@0 | 303 | /** |
aoqi@0 | 304 | * Used for instances of {@link UnaryTree} representing prefix |
aoqi@0 | 305 | * decrement operator {@code --}. |
aoqi@0 | 306 | */ |
aoqi@0 | 307 | PREFIX_DECREMENT(UnaryTree.class), |
aoqi@0 | 308 | |
aoqi@0 | 309 | /** |
aoqi@0 | 310 | * Used for instances of {@link UnaryTree} representing unary plus |
aoqi@0 | 311 | * operator {@code +}. |
aoqi@0 | 312 | */ |
aoqi@0 | 313 | UNARY_PLUS(UnaryTree.class), |
aoqi@0 | 314 | |
aoqi@0 | 315 | /** |
aoqi@0 | 316 | * Used for instances of {@link UnaryTree} representing unary minus |
aoqi@0 | 317 | * operator {@code -}. |
aoqi@0 | 318 | */ |
aoqi@0 | 319 | UNARY_MINUS(UnaryTree.class), |
aoqi@0 | 320 | |
aoqi@0 | 321 | /** |
aoqi@0 | 322 | * Used for instances of {@link UnaryTree} representing bitwise |
aoqi@0 | 323 | * complement operator {@code ~}. |
aoqi@0 | 324 | */ |
aoqi@0 | 325 | BITWISE_COMPLEMENT(UnaryTree.class), |
aoqi@0 | 326 | |
aoqi@0 | 327 | /** |
aoqi@0 | 328 | * Used for instances of {@link UnaryTree} representing logical |
aoqi@0 | 329 | * complement operator {@code !}. |
aoqi@0 | 330 | */ |
aoqi@0 | 331 | LOGICAL_COMPLEMENT(UnaryTree.class), |
aoqi@0 | 332 | |
aoqi@0 | 333 | /** |
aoqi@0 | 334 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 335 | * multiplication {@code *}. |
aoqi@0 | 336 | */ |
aoqi@0 | 337 | MULTIPLY(BinaryTree.class), |
aoqi@0 | 338 | |
aoqi@0 | 339 | /** |
aoqi@0 | 340 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 341 | * division {@code /}. |
aoqi@0 | 342 | */ |
aoqi@0 | 343 | DIVIDE(BinaryTree.class), |
aoqi@0 | 344 | |
aoqi@0 | 345 | /** |
aoqi@0 | 346 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 347 | * remainder {@code %}. |
aoqi@0 | 348 | */ |
aoqi@0 | 349 | REMAINDER(BinaryTree.class), |
aoqi@0 | 350 | |
aoqi@0 | 351 | /** |
aoqi@0 | 352 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 353 | * addition or string concatenation {@code +}. |
aoqi@0 | 354 | */ |
aoqi@0 | 355 | PLUS(BinaryTree.class), |
aoqi@0 | 356 | |
aoqi@0 | 357 | /** |
aoqi@0 | 358 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 359 | * subtraction {@code -}. |
aoqi@0 | 360 | */ |
aoqi@0 | 361 | MINUS(BinaryTree.class), |
aoqi@0 | 362 | |
aoqi@0 | 363 | /** |
aoqi@0 | 364 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 365 | * left shift {@code <<}. |
aoqi@0 | 366 | */ |
aoqi@0 | 367 | LEFT_SHIFT(BinaryTree.class), |
aoqi@0 | 368 | |
aoqi@0 | 369 | /** |
aoqi@0 | 370 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 371 | * right shift {@code >>}. |
aoqi@0 | 372 | */ |
aoqi@0 | 373 | RIGHT_SHIFT(BinaryTree.class), |
aoqi@0 | 374 | |
aoqi@0 | 375 | /** |
aoqi@0 | 376 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 377 | * unsigned right shift {@code >>>}. |
aoqi@0 | 378 | */ |
aoqi@0 | 379 | UNSIGNED_RIGHT_SHIFT(BinaryTree.class), |
aoqi@0 | 380 | |
aoqi@0 | 381 | /** |
aoqi@0 | 382 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 383 | * less-than {@code <}. |
aoqi@0 | 384 | */ |
aoqi@0 | 385 | LESS_THAN(BinaryTree.class), |
aoqi@0 | 386 | |
aoqi@0 | 387 | /** |
aoqi@0 | 388 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 389 | * greater-than {@code >}. |
aoqi@0 | 390 | */ |
aoqi@0 | 391 | GREATER_THAN(BinaryTree.class), |
aoqi@0 | 392 | |
aoqi@0 | 393 | /** |
aoqi@0 | 394 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 395 | * less-than-equal {@code <=}. |
aoqi@0 | 396 | */ |
aoqi@0 | 397 | LESS_THAN_EQUAL(BinaryTree.class), |
aoqi@0 | 398 | |
aoqi@0 | 399 | /** |
aoqi@0 | 400 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 401 | * greater-than-equal {@code >=}. |
aoqi@0 | 402 | */ |
aoqi@0 | 403 | GREATER_THAN_EQUAL(BinaryTree.class), |
aoqi@0 | 404 | |
aoqi@0 | 405 | /** |
aoqi@0 | 406 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 407 | * equal-to {@code ==}. |
aoqi@0 | 408 | */ |
aoqi@0 | 409 | EQUAL_TO(BinaryTree.class), |
aoqi@0 | 410 | |
aoqi@0 | 411 | /** |
aoqi@0 | 412 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 413 | * not-equal-to {@code !=}. |
aoqi@0 | 414 | */ |
aoqi@0 | 415 | NOT_EQUAL_TO(BinaryTree.class), |
aoqi@0 | 416 | |
aoqi@0 | 417 | /** |
aoqi@0 | 418 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 419 | * bitwise and logical "and" {@code &}. |
aoqi@0 | 420 | */ |
aoqi@0 | 421 | AND(BinaryTree.class), |
aoqi@0 | 422 | |
aoqi@0 | 423 | /** |
aoqi@0 | 424 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 425 | * bitwise and logical "xor" {@code ^}. |
aoqi@0 | 426 | */ |
aoqi@0 | 427 | XOR(BinaryTree.class), |
aoqi@0 | 428 | |
aoqi@0 | 429 | /** |
aoqi@0 | 430 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 431 | * bitwise and logical "or" {@code |}. |
aoqi@0 | 432 | */ |
aoqi@0 | 433 | OR(BinaryTree.class), |
aoqi@0 | 434 | |
aoqi@0 | 435 | /** |
aoqi@0 | 436 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 437 | * conditional-and {@code &&}. |
aoqi@0 | 438 | */ |
aoqi@0 | 439 | CONDITIONAL_AND(BinaryTree.class), |
aoqi@0 | 440 | |
aoqi@0 | 441 | /** |
aoqi@0 | 442 | * Used for instances of {@link BinaryTree} representing |
aoqi@0 | 443 | * conditional-or {@code ||}. |
aoqi@0 | 444 | */ |
aoqi@0 | 445 | CONDITIONAL_OR(BinaryTree.class), |
aoqi@0 | 446 | |
aoqi@0 | 447 | /** |
aoqi@0 | 448 | * Used for instances of {@link CompoundAssignmentTree} representing |
aoqi@0 | 449 | * multiplication assignment {@code *=}. |
aoqi@0 | 450 | */ |
aoqi@0 | 451 | MULTIPLY_ASSIGNMENT(CompoundAssignmentTree.class), |
aoqi@0 | 452 | |
aoqi@0 | 453 | /** |
aoqi@0 | 454 | * Used for instances of {@link CompoundAssignmentTree} representing |
aoqi@0 | 455 | * division assignment {@code /=}. |
aoqi@0 | 456 | */ |
aoqi@0 | 457 | DIVIDE_ASSIGNMENT(CompoundAssignmentTree.class), |
aoqi@0 | 458 | |
aoqi@0 | 459 | /** |
aoqi@0 | 460 | * Used for instances of {@link CompoundAssignmentTree} representing |
aoqi@0 | 461 | * remainder assignment {@code %=}. |
aoqi@0 | 462 | */ |
aoqi@0 | 463 | REMAINDER_ASSIGNMENT(CompoundAssignmentTree.class), |
aoqi@0 | 464 | |
aoqi@0 | 465 | /** |
aoqi@0 | 466 | * Used for instances of {@link CompoundAssignmentTree} representing |
aoqi@0 | 467 | * addition or string concatenation assignment {@code +=}. |
aoqi@0 | 468 | */ |
aoqi@0 | 469 | PLUS_ASSIGNMENT(CompoundAssignmentTree.class), |
aoqi@0 | 470 | |
aoqi@0 | 471 | /** |
aoqi@0 | 472 | * Used for instances of {@link CompoundAssignmentTree} representing |
aoqi@0 | 473 | * subtraction assignment {@code -=}. |
aoqi@0 | 474 | */ |
aoqi@0 | 475 | MINUS_ASSIGNMENT(CompoundAssignmentTree.class), |
aoqi@0 | 476 | |
aoqi@0 | 477 | /** |
aoqi@0 | 478 | * Used for instances of {@link CompoundAssignmentTree} representing |
aoqi@0 | 479 | * left shift assignment {@code <<=}. |
aoqi@0 | 480 | */ |
aoqi@0 | 481 | LEFT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class), |
aoqi@0 | 482 | |
aoqi@0 | 483 | /** |
aoqi@0 | 484 | * Used for instances of {@link CompoundAssignmentTree} representing |
aoqi@0 | 485 | * right shift assignment {@code >>=}. |
aoqi@0 | 486 | */ |
aoqi@0 | 487 | RIGHT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class), |
aoqi@0 | 488 | |
aoqi@0 | 489 | /** |
aoqi@0 | 490 | * Used for instances of {@link CompoundAssignmentTree} representing |
aoqi@0 | 491 | * unsigned right shift assignment {@code >>>=}. |
aoqi@0 | 492 | */ |
aoqi@0 | 493 | UNSIGNED_RIGHT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class), |
aoqi@0 | 494 | |
aoqi@0 | 495 | /** |
aoqi@0 | 496 | * Used for instances of {@link CompoundAssignmentTree} representing |
aoqi@0 | 497 | * bitwise and logical "and" assignment {@code &=}. |
aoqi@0 | 498 | */ |
aoqi@0 | 499 | AND_ASSIGNMENT(CompoundAssignmentTree.class), |
aoqi@0 | 500 | |
aoqi@0 | 501 | /** |
aoqi@0 | 502 | * Used for instances of {@link CompoundAssignmentTree} representing |
aoqi@0 | 503 | * bitwise and logical "xor" assignment {@code ^=}. |
aoqi@0 | 504 | */ |
aoqi@0 | 505 | XOR_ASSIGNMENT(CompoundAssignmentTree.class), |
aoqi@0 | 506 | |
aoqi@0 | 507 | /** |
aoqi@0 | 508 | * Used for instances of {@link CompoundAssignmentTree} representing |
aoqi@0 | 509 | * bitwise and logical "or" assignment {@code |=}. |
aoqi@0 | 510 | */ |
aoqi@0 | 511 | OR_ASSIGNMENT(CompoundAssignmentTree.class), |
aoqi@0 | 512 | |
aoqi@0 | 513 | /** |
aoqi@0 | 514 | * Used for instances of {@link LiteralTree} representing |
aoqi@0 | 515 | * an integral literal expression of type {@code int}. |
aoqi@0 | 516 | */ |
aoqi@0 | 517 | INT_LITERAL(LiteralTree.class), |
aoqi@0 | 518 | |
aoqi@0 | 519 | /** |
aoqi@0 | 520 | * Used for instances of {@link LiteralTree} representing |
aoqi@0 | 521 | * an integral literal expression of type {@code long}. |
aoqi@0 | 522 | */ |
aoqi@0 | 523 | LONG_LITERAL(LiteralTree.class), |
aoqi@0 | 524 | |
aoqi@0 | 525 | /** |
aoqi@0 | 526 | * Used for instances of {@link LiteralTree} representing |
aoqi@0 | 527 | * a floating-point literal expression of type {@code float}. |
aoqi@0 | 528 | */ |
aoqi@0 | 529 | FLOAT_LITERAL(LiteralTree.class), |
aoqi@0 | 530 | |
aoqi@0 | 531 | /** |
aoqi@0 | 532 | * Used for instances of {@link LiteralTree} representing |
aoqi@0 | 533 | * a floating-point literal expression of type {@code double}. |
aoqi@0 | 534 | */ |
aoqi@0 | 535 | DOUBLE_LITERAL(LiteralTree.class), |
aoqi@0 | 536 | |
aoqi@0 | 537 | /** |
aoqi@0 | 538 | * Used for instances of {@link LiteralTree} representing |
aoqi@0 | 539 | * a boolean literal expression of type {@code boolean}. |
aoqi@0 | 540 | */ |
aoqi@0 | 541 | BOOLEAN_LITERAL(LiteralTree.class), |
aoqi@0 | 542 | |
aoqi@0 | 543 | /** |
aoqi@0 | 544 | * Used for instances of {@link LiteralTree} representing |
aoqi@0 | 545 | * a character literal expression of type {@code char}. |
aoqi@0 | 546 | */ |
aoqi@0 | 547 | CHAR_LITERAL(LiteralTree.class), |
aoqi@0 | 548 | |
aoqi@0 | 549 | /** |
aoqi@0 | 550 | * Used for instances of {@link LiteralTree} representing |
aoqi@0 | 551 | * a string literal expression of type {@link String}. |
aoqi@0 | 552 | */ |
aoqi@0 | 553 | STRING_LITERAL(LiteralTree.class), |
aoqi@0 | 554 | |
aoqi@0 | 555 | /** |
aoqi@0 | 556 | * Used for instances of {@link LiteralTree} representing |
aoqi@0 | 557 | * the use of {@code null}. |
aoqi@0 | 558 | */ |
aoqi@0 | 559 | NULL_LITERAL(LiteralTree.class), |
aoqi@0 | 560 | |
aoqi@0 | 561 | /** |
aoqi@0 | 562 | * Used for instances of {@link WildcardTree} representing |
aoqi@0 | 563 | * an unbounded wildcard type argument. |
aoqi@0 | 564 | */ |
aoqi@0 | 565 | UNBOUNDED_WILDCARD(WildcardTree.class), |
aoqi@0 | 566 | |
aoqi@0 | 567 | /** |
aoqi@0 | 568 | * Used for instances of {@link WildcardTree} representing |
aoqi@0 | 569 | * an extends bounded wildcard type argument. |
aoqi@0 | 570 | */ |
aoqi@0 | 571 | EXTENDS_WILDCARD(WildcardTree.class), |
aoqi@0 | 572 | |
aoqi@0 | 573 | /** |
aoqi@0 | 574 | * Used for instances of {@link WildcardTree} representing |
aoqi@0 | 575 | * a super bounded wildcard type argument. |
aoqi@0 | 576 | */ |
aoqi@0 | 577 | SUPER_WILDCARD(WildcardTree.class), |
aoqi@0 | 578 | |
aoqi@0 | 579 | /** |
aoqi@0 | 580 | * Used for instances of {@link ErroneousTree}. |
aoqi@0 | 581 | */ |
aoqi@0 | 582 | ERRONEOUS(ErroneousTree.class), |
aoqi@0 | 583 | |
aoqi@0 | 584 | /** |
aoqi@0 | 585 | * Used for instances of {@link ClassTree} representing interfaces. |
aoqi@0 | 586 | */ |
aoqi@0 | 587 | INTERFACE(ClassTree.class), |
aoqi@0 | 588 | |
aoqi@0 | 589 | /** |
aoqi@0 | 590 | * Used for instances of {@link ClassTree} representing enums. |
aoqi@0 | 591 | */ |
aoqi@0 | 592 | ENUM(ClassTree.class), |
aoqi@0 | 593 | |
aoqi@0 | 594 | /** |
aoqi@0 | 595 | * Used for instances of {@link ClassTree} representing annotation types. |
aoqi@0 | 596 | */ |
aoqi@0 | 597 | ANNOTATION_TYPE(ClassTree.class), |
aoqi@0 | 598 | |
aoqi@0 | 599 | /** |
aoqi@0 | 600 | * An implementation-reserved node. This is the not the node |
aoqi@0 | 601 | * you are looking for. |
aoqi@0 | 602 | */ |
aoqi@0 | 603 | OTHER(null); |
aoqi@0 | 604 | |
aoqi@0 | 605 | |
aoqi@0 | 606 | Kind(Class<? extends Tree> intf) { |
aoqi@0 | 607 | associatedInterface = intf; |
aoqi@0 | 608 | } |
aoqi@0 | 609 | |
aoqi@0 | 610 | public Class<? extends Tree> asInterface() { |
aoqi@0 | 611 | return associatedInterface; |
aoqi@0 | 612 | } |
aoqi@0 | 613 | |
aoqi@0 | 614 | private final Class<? extends Tree> associatedInterface; |
aoqi@0 | 615 | } |
aoqi@0 | 616 | |
aoqi@0 | 617 | /** |
aoqi@0 | 618 | * Gets the kind of this tree. |
aoqi@0 | 619 | * |
aoqi@0 | 620 | * @return the kind of this tree. |
aoqi@0 | 621 | */ |
aoqi@0 | 622 | Kind getKind(); |
aoqi@0 | 623 | |
aoqi@0 | 624 | /** |
aoqi@0 | 625 | * Accept method used to implement the visitor pattern. The |
aoqi@0 | 626 | * visitor pattern is used to implement operations on trees. |
aoqi@0 | 627 | * |
aoqi@0 | 628 | * @param <R> result type of this operation. |
aoqi@0 | 629 | * @param <D> type of additional data. |
aoqi@0 | 630 | */ |
aoqi@0 | 631 | <R,D> R accept(TreeVisitor<R,D> visitor, D data); |
aoqi@0 | 632 | } |