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.env.event.broadcaster.ConsumableEventInfo; 19 20 /** 21 * {@code SimpleConsumableEventInfo} offers support for consuming events. 22 * 23 * @author Martin Heidegger 24 * @author Simon Wacker 25 */ 26 class org.as2lib.env.event.broadcaster.SimpleConsumableEventInfo extends BasicClass implements ConsumableEventInfo { 27 28 /** The name of the event */ 29 private var eventName:String; 30 31 /** Determines whether this event is consumed. */ 32 private var consumed:Boolean; 33 34 /** 35 * Constructs a {@code SimpleConsumableEventInfo} instance. 36 * 37 * @param eventName the name of the event 38 */ 39 public function SimpleConsumableEventInfo(eventName:String) { 40 this.eventName = eventName; 41 this.consumed = false; 42 } 43 44 /** 45 * Returns the name of the event. 46 * 47 * @return the name of the event 48 */ 49 public function getName(Void):String { 50 return this.eventName; 51 } 52 53 /** 54 * Returns whether the event is consumed. 55 * 56 * @return {@code true} if the event is consumed else {@code false} 57 */ 58 public function isConsumed(Void):Boolean { 59 return this.consumed; 60 } 61 62 /** 63 * Consumes the represented event. 64 */ 65 public function consume(Void):Void { 66 this.consumed = true; 67 } 68 69 }