View Javadoc

1   /*
2    * ASDoWhileStatement.java
3    * 
4    * Copyright (c) 2007 David Holroyd
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package uk.co.badgersinfoil.metaas.dom;
20  
21  
22  /**
23   * A do-while loop, such as <code>do {  } while (condition);</code>.
24   * 
25   * <p>e.g. The following Java code,</p>
26   * <pre class="eg">ASDoWhileStatement doWhile = method.newDoWhile("test()");
27   *doWhile.addStmt("trace('still testing')");</pre>
28   * <p>Will result in AS which looks like this,</p>
29   * <pre class="eg">do {
30   *	trace('still testing');
31   *} while (test());</pre>
32   *
33   * @see StatementContainer#newDoWhile(String)
34   */
35  public interface ASDoWhileStatement extends Statement, StatementContainer {
36  
37  	/**
38  	 * Returns a string representation of the loop termination condition
39  	 * expression.
40  	 * 
41  	 * <p>e.g. given the loop,</p>
42  	 * <pre class="eg">do { nothing(); } while (test());</pre>
43  	 * <p>This method would return <code>"test()"</code>.</p>
44  	 */
45  	public String getConditionString();
46  
47  	public Expression getCondition();
48  
49  	/**
50  	 * Sets the loop termination condition for this do-while loop.
51  	 * 
52  	 * @throws uk.co.badgersinfoil.metaas.SyntaxException if the given
53  	 * string is not a valid ActionScript expression.
54  	 */
55  	public void setCondition(String expr);
56  
57  	public void setCondition(Expression expr);
58  }