com.togethersoft.sca.ast
Interface AstSwitchStatement

All Superinterfaces:
AstObject, AstStatement

public interface AstSwitchStatement
extends AstStatement

Represents a switch statement. For example:

     switch (kind) {
     case ATTR:
     case NODE:
 
     default:
     }
 

A switch statement's body is a a collection of switch groups. A switch group is a (possibly empty) set of statements with the associated case labels.


Fields inherited from interface com.togethersoft.sca.ast.AstObject
ARRAY_CREATION, ARRAY_INITIALIZER, ARRAY_REFERENCE, ASSERT_STATEMENT, ASSIGNMENT_EXPRESSION, BINARY_EXPRESSION, BREAK_STATEMENT, CASE_LABEL, CAST_EXPRESSION, CATCH_CLAUSE, CLASS_FILE, COMMENT, COMPILATION_UNIT, COMPOUND_STATEMENT, CONDITIONAL_EXPRESSION, CONSTRUCTOR_INVOCATION, CONTINUE_STATEMENT, DBC_RESULT, DECLARATION_STATEMENT, DO_STATEMENT, EMPTY_STATEMENT, EXPRESSION_STATEMENT, FIELD_REFERENCE, FINALLY_CLAUSE, FOR_STATEMENT, IF_STATEMENT, IMPORT, INITIALIZER, JAVADOC_TAG, LITERAL, METHOD, METHOD_CALL_EXPRESSION, N_A, OBJECT_CREATION_EXPRESSION, PACKAGE, PARENTHESIZED_EXPRESSION, RETURN_STATEMENT, SIMPLE_REFERENCE, SUPER_EXPRESSION, SWITCH_GROUP, SWITCH_STATEMENT, SYNCHRONIZED_STATEMENT, THIS_EXPRESSION, THROW_SPECIFIER, THROW_STATEMENT, TRY_STATEMENT, TYPE, TYPE_EXPRESSION, UNARY_EXPRESSION, VARIABLE, VARIABLE_DECLARATION, WHILE_STATEMENT
 
Method Summary
 AstSwitchGroup[] getBody()
          Returns the body of this switch statement.
 AstCaseLabel getCaseLabel(int i)
          Returns the case label with the specified number.
 AstExpression getCondition()
          Returns the selection expression of this switch statement.
 AstSwitchGroup getDefaultGroup()
          Returns a switch group that has the the default label, returns null if this switch statement has no default label.
 
Methods inherited from interface com.togethersoft.sca.ast.AstStatement
getLabelNames
 
Methods inherited from interface com.togethersoft.sca.ast.AstObject
addComment, getChildren, getComments, getCompilationUnit, getDeclaringMethod, getDeclaringType, getObjectKind, getPackage, getParent, getPosition, isDeleted, remove, replaceWith, replaceWith, setPosition, setPositionAfter, visitExpressions, visitStatements
 

Method Detail

getBody

public AstSwitchGroup[] getBody()
Returns the body of this switch statement. Returns an empty array if this switch statement has an empty body.
Returns:
the body of this switch statement.

getCaseLabel

public AstCaseLabel getCaseLabel(int i)
Returns the case label with the specified number. Case labels are numbered starting from zero in the order in which they appear in source code.

Returns null if case label with the specified number does not exist.

Parameters:
i - the number of the case label.
Returns:
the case label with the specified number.

getCondition

public AstExpression getCondition()
Returns the selection expression of this switch statement.
Returns:
the selection expression of this switch statement.

getDefaultGroup

public AstSwitchGroup getDefaultGroup()
Returns a switch group that has the the default label, returns null if this switch statement has no default label.
Returns:
the default switch group.