View Javadoc

1   /*
2    * ASSwitchCase.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 switch-statement <code>case</code>-label, and the list of statements
23   * immediately following it.
24   * 
25   * <p>For example, given the following code...</p>
26   * 
27   * <pre class="eg">switch (c) {
28   *    <strong>case 1:
29   *	trace("one");
30   *	break;</strong>
31   *    default:
32   *	trace("many");
33   *}</pre>
34   * 
35   * <p>...an ASSwitchCase would be available with label-value of <code>1</code>
36   * which will provide the <code>trace("one");</code> and <code>break;</code>
37   * statements when its {@link #getStatementList()} method is called.</p>
38   * 
39   * @see ASSwitchStatement#newCase(String)
40   * @see ASSwitchStatement
41   */
42  public interface ASSwitchCase extends SwitchLabel {
43  
44  	/**
45  	 * Returns a the value expression for this label.
46  	 */
47  	public Expression getLabelValue();
48  	
49  	/**
50  	 * Returns a string representation of the value expression for this
51  	 * label.  e.g. given the label <code>case 42:</code>, this method
52  	 * would return the string <code>"42"</code>.
53  	 */
54  	public String getLabelValueString();
55  
56  	/**
57  	 * Changes the value expression for this case label.
58  	 * 
59  	 * @throws uk.co.badgersinfoil.metaas.SyntaxException if the given
60  	 * string is not a valid ActionScript expression.
61  	 */
62  	public void setLabelValue(String constant);
63  }