View Javadoc

1   /*
2    * ASExpressionStatement.java
3    * 
4    * Copyright (c) 2007-2008 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   * A simple statement which evaluates an expression.
23   * 
24   * <p>Instances can be created using {@link StatementContainer#newExprStmt(String)}:</p>
25   * <pre class="eg">ASExpressionStatement stmt = method.newExprStmt("trace(\"hello world\")");</pre>
26   * <p>Will result in the ActionScript code,</p>
27   * <pre class="eg">trace("hello world");</pre>
28   * 
29   * @see StatementContainer#newExprStmt(Expression)
30   */
31  public interface ASExpressionStatement extends Statement {
32  
33  	/**
34  	 * Returns the expression this statement would evaluate when run.
35  	 */
36  	public Expression getExpression();
37  	
38  	/**
39  	 * Returns a string representation of the expression this statement
40  	 * would evaluate when run.
41  	 */
42  	public String getExpressionString();
43  	
44  	/**
45  	 * Changes the expression that this statement would evaluate when run.
46  	 * 
47  	 * @throws SyntaxException if the given string is not a valid
48  	 *         ActionScript expression.
49  	 */
50  	public void setExpression(String expr);
51  }