uk.co.badgersinfoil.metaas.dom
Interface ASForStatement

All Superinterfaces:
ScriptElement, Statement, StatementContainer

public interface ASForStatement
extends Statement, StatementContainer

A for statement, such as for (; ; ) { }.

e.g. The Java code

ASForStatement forStmt = method.newFor("var i=0", "i<10", "i++");
forStmt.addStmt("trace(i)");

Will create ActionScript code like,

for (var i=0; i<10; i++) {
        trace(i);
}

See Also:
StatementContainer.newFor(Expression, Expression, Expression)

Method Summary
 Expression getCondition()
           
 java.lang.String getConditionString()
          Returns a string representation of the loop termination condition expression.
 ScriptElement getInit()
          Returns a script element representing the initialisation part of this for-statement.
 java.lang.String getInitString()
          Returns a string representation of the loop initialisation expression.
 Expression getUpdate()
           
 java.lang.String getUpdateString()
          Returns a string representation of the loop update expression.
 void setCondition(Expression expr)
           
 void setCondition(java.lang.String expr)
          Changes the termination condition expression for this loop.
 void setInit(java.lang.String expr)
          Changes the initialisation expression for this loop.
 void setUpdate(Expression expr)
           
 void setUpdate(java.lang.String expr)
          Changes the update expression for this loop.
 
Methods inherited from interface uk.co.badgersinfoil.metaas.dom.StatementContainer
addComment, addStmt, containsCode, getStatementList, newBreak, newContinue, newDeclaration, newDeclaration, newDefaultXMLNamespace, newDoWhile, newDoWhile, newExprStmt, newExprStmt, newFor, newFor, newForEachIn, newForEachIn, newForIn, newForIn, newIf, newIf, newReturn, newReturn, newReturn, newSuper, newSwitch, newSwitch, newThrow, newTryCatch, newTryFinally, newWhile, newWhile, newWith, newWith
 

Method Detail

getInitString

java.lang.String getInitString()
Returns a string representation of the loop initialisation expression. e.g. given the loop for (var i=0; i<10; i++), this method will return the string "var i=0".


getInit

ScriptElement getInit()
Returns a script element representing the initialisation part of this for-statement.

The return value depends on the kind of initialiser present:

No initialiser: for (; ; )
Returns null
Expression initialiser: for (v=1; ; )
Returns an Expression
Declaration initialiser: for (var v=1; ; )
Returns an ASDeclarationStatement


getConditionString

java.lang.String getConditionString()
Returns a string representation of the loop termination condition expression. e.g. given the loop for (var i=0; i<10; i++), this method will return the string "i<10".


getCondition

Expression getCondition()

getUpdateString

java.lang.String getUpdateString()
Returns a string representation of the loop update expression. e.g. given the loop for (var i=0; i<10; i++), this method will return the string "i++".


getUpdate

Expression getUpdate()

setInit

void setInit(java.lang.String expr)
Changes the initialisation expression for this loop.

Throws:
SyntaxException - if the given string is not a valid ActionScript expression.

setCondition

void setCondition(java.lang.String expr)
Changes the termination condition expression for this loop.

Throws:
SyntaxException - if the given string is not a valid ActionScript expression.

setCondition

void setCondition(Expression expr)

setUpdate

void setUpdate(java.lang.String expr)
Changes the update expression for this loop.

Throws:
SyntaxException - if the given string is not a valid ActionScript expression.

setUpdate

void setUpdate(Expression expr)


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