uk.co.badgersinfoil.metaas.dom
Interface ASSwitchStatement

All Superinterfaces:
ScriptElement, Statement

public interface ASSwitchStatement
extends Statement

A switch-statement, such as switch (c) { }.

Allows case and default statements to be added to to the switch-statement body. e.g.

 ASSwitchStatement switchStmt = method.newSwitch("c");
 switchStmt.newCase("'a'").addStmt("aay()");
 switchStmt.newCase("'b'").addStmt("bee()");
 switchStmt.newDefault().addStmt("cee()");
 
Will result in ActionScript something like,
 switch(c) {
        case 'a':
                aay();
        case 'b':
                bee();
        default:
                cee();
 }
 

To add break statements to either case or default labels, use switchLabel.newBreak().

See Also:
StatementContainer.newSwitch(String), ASSwitchCase, ASSwitchDefault

Method Summary
 Expression getCondition()
           
 java.util.List getLabels()
          Returns a list of SwitchLabel elements (i.e.
 ASSwitchCase newCase(java.lang.String string)
          Creates a case-label in this switch-statement with the given value, to which other statements can be added.
 ASSwitchDefault newDefault()
          Creates a default-label in this switch-statement, to which other statements can be added.
 void setCondition(Expression expr)
           
 

Method Detail

newCase

ASSwitchCase newCase(java.lang.String string)
Creates a case-label in this switch-statement with the given value, to which other statements can be added.


newDefault

ASSwitchDefault newDefault()
Creates a default-label in this switch-statement, to which other statements can be added.


getCondition

Expression getCondition()

setCondition

void setCondition(Expression expr)

getLabels

java.util.List getLabels()
Returns a list of SwitchLabel elements (i.e. either ASSwitchCase or ASSwitchDefault).



Copyright © 2006-2008 David Holroyd. All Rights Reserved.