1  /*
     2   * Copyright the original author or authors.
     3   * 
     4   * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   * 
     8   *      http://www.mozilla.org/MPL/MPL-1.1.html
     9   * 
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  import org.as2lib.core.BasicClass;
    18  import org.as2lib.aop.Pointcut;
    19  
    20  /**
    21   * {@code AbstractCompositePointcut} provides implementations of methods commonly
    22   * needed by {@link CompositePointcut} implementation classes.
    23   * 
    24   * @author Simon Wacker
    25   */
    26  class org.as2lib.aop.pointcut.AbstractCompositePointcut extends BasicClass {
    27  	
    28  	/** All added pointcuts. */
    29  	private var pointcuts:Array;
    30  	
    31  	/**
    32  	 * Constructs a new {@code AbstractCompositePointcut} instance.
    33  	 */
    34  	private function AbstractCompositePointcut(Void) {
    35  		this.pointcuts = new Array();
    36  	}
    37  	
    38  	/**
    39  	 * Adds a new pointcut to the list of pointcuts.
    40  	 *
    41  	 * <p>The {@code pointcut} is not added if it is {@code null} or {@code undefined}.
    42  	 *
    43  	 * @param pointcut the pointcut to add
    44  	 */
    45  	public function addPointcut(pointcut:Pointcut):Void {
    46  		if (pointcut) this.pointcuts.push(pointcut);
    47  	}
    48  	
    49  	/**
    50  	 * Returns all added pointcuts.
    51  	 * 
    52  	 * @return all added pointcuts
    53  	 */
    54  	public function getPointcuts(Void):Array {
    55  		return this.pointcuts.concat();
    56  	}
    57  	
    58  }