Source code: javax/ide/model/java/source/tree/StatementT.java
1 /*
2 * @(#)StatementT.java
3 */
4
5 package javax.ide.model.java.source.tree;
6
7 import java.util.List;
8
9 /**
10 * Common supertype of all statements. All statements can be
11 * classified as: simple, block, compound. Block statements are
12 * statements that are blocks. Simple statements have no child
13 * statements and optionally have expressions. Compound statements
14 * have child statements and optionally have expressions. <p/>
15 *
16 * @author Andy Yu
17 * */
18 public interface StatementT
19 extends Tree, BlockElementT
20 {
21 // ----------------------------------------------------------------------
22
23 public final static StatementT[] EMPTY_ARRAY = new StatementT[ 0 ];
24
25
26 // ----------------------------------------------------------------------
27
28 /**
29 * @return The token identifying what kind of statement this is.
30 *
31 * For simple statements, you'll get:
32 * 0: "expr;". Optional primary expression.
33 * KW_RETURN: "return optional_expr;". Optional primary expression.
34 * KW_THROW: "throw expr;". Required primary expression.
35 * KW_BREAK: "break optional_label_name;". Optional name.
36 * KW_CONTINUE: "continue optional_label_name;". Optional name.
37 * KW_CASE: "case expr:". Required primary expression.
38 * KW_DEFAULT: "default:".
39 * KW_ASSERT: "assert boolean-expr: output-expr;".
40 * Required primary expression, optional output expression.
41 */
42 public short getStatementToken();
43
44 /**
45 * @return The StatementLabelT array corresponding to this statement's
46 * label. Unlike all the other parse tree API array calls, this
47 * returns null if there are no labels. This is because labels
48 * rarely occur and there's no point creating a zero-length array
49 * for each statement. <p/>
50 *
51 * List of StatementLabelTs.
52 */
53 public List getStatementLabels();
54
55
56 // ----------------------------------------------------------------------
57 }