View Javadoc

1   /*
2    * ASPrefixExpression.java
3    * 
4    * Copyright (c) 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 prefix-expression, such as <code>!a</code> or <code>++a</code>.
23   * 
24   * @see uk.co.badgersinfoil.metaas.ActionScriptFactory#newPositiveExpression(Expression)
25   * @see uk.co.badgersinfoil.metaas.ActionScriptFactory#newPreDecExpression(Expression)
26   * @see uk.co.badgersinfoil.metaas.ActionScriptFactory#newPostIncExpression(Expression)
27   * @see uk.co.badgersinfoil.metaas.ActionScriptFactory#newNotExpression(Expression)
28   * @see uk.co.badgersinfoil.metaas.ActionScriptFactory#newNegativeExpression(Expression)
29   */
30  public interface ASPrefixExpression extends Expression {
31  	public Op getOperator();
32  	public void setOperator(Op operator);
33  	public Expression getSubexpression();
34  	public void setSubexpression(Expression expression);
35  
36  	/**
37  	 * The operators allowed for a prefix-expression
38  	 */
39  	public static class Op {
40  		private String name;
41  		private Op(String name) {
42  			this.name = name;
43  		}
44  
45  		/** Negation <code>-expr</code> */
46  		public static final Op NEG = new Op("NEG");
47  		/** Inverse <code>!expr</code> */
48  		public static final Op NOT = new Op("NOT");
49  		/** Positive expression <code>+expr</code> */
50  		public static final Op POS = new Op("POS");
51  		/** Pre-decrement <code>--expr</code> */
52  		public static final Op PREDEC = new Op("PREDEC");
53  		/** Pre-increment <code>++expr</code> */
54  		public static final Op PREINC = new Op("PREINC");
55  
56  		public String toString() {
57  			return name;
58  		}		
59  	}
60  }