Commits

Anonymous committed c637dfd Merge

Merge branch 'master' of git://github.com/robertpenner/as3-signals

Comments (0)

Files changed (12)

src/org/osflash/signals/DeluxeSignal.as

 			_target = value;
 		}
 
-		/** @inheritDoc */
+		/**
+		 * @inheritDoc
+		 * @throws ArgumentError <code>ArgumentError</code>: Incorrect number of arguments.
+		 * @throws ArgumentError <code>ArgumentError</code>: Value object is not an instance of the appropriate valueClasses Class.
+		 */
 		override public function dispatch(...valueObjects):void
 		{
 			// Validate value objects against pre-defined value classes.

src/org/osflash/signals/MonoSignal.as

 			this.valueClasses = (valueClasses.length == 1 && valueClasses[0] is Array) ? valueClasses[0] : valueClasses;
 		}
 		
-		/** @inheritDoc */
+		/**
+		 * @inheritDoc
+		 * @throws ArgumentError <code>ArgumentError</code>: Invalid valueClasses argument: item at index should be a Class but was not.
+		 */
 		[ArrayElementType("Class")]
 		public function get valueClasses():Array { return _valueClasses; }
 		
 		/** @inheritDoc */
 		public function get numListeners():uint { return slot ? 1 : 0; }
 		
-		/** @inheritDoc */
-		//TODO: @throws
+		/**
+		 * @inheritDoc
+		 * @throws flash.errors.IllegalOperationError <code>IllegalOperationError</code>: You cannot add or addOnce with a listener already added, remove the current listener first.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 */
 		public function add(listener:Function):ISlot
 		{
 			return registerListener(listener);
 		}
 		
-		/** @inheritDoc */
+		/**
+		 * @inheritDoc
+		 * @throws flash.errors.IllegalOperationError <code>IllegalOperationError</code>: You cannot add or addOnce with a listener already added, remove the current listener first.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 */
 		public function addOnce(listener:Function):ISlot
 		{
 			return registerListener(listener, true);
 			if (slot) slot.remove();
 		}
 		
-		/** @inheritDoc */
+		/**
+		 * @inheritDoc
+		 * @throws ArgumentError <code>ArgumentError</code>: Incorrect number of arguments.
+		 * @throws ArgumentError <code>ArgumentError</code>: Value object is not an instance of the appropriate valueClasses Class.
+		 */
 		public function dispatch(...valueObjects):void
 		{
 			// If valueClasses is empty, value objects are not type-checked. 

src/org/osflash/signals/OnceSignal.as

 			this.valueClasses = (valueClasses.length == 1 && valueClasses[0] is Array) ? valueClasses[0] : valueClasses;
 		}
 		
-		/** @inheritDoc */
+		/**
+		 * @inheritDoc
+		 * @throws ArgumentError <code>ArgumentError</code>: Invalid valueClasses argument: item at index should be a Class but was not.
+		 */
 		[ArrayElementType("Class")]
 		public function get valueClasses():Array { return _valueClasses; }
 		
 		/** @inheritDoc */
 		public function get numListeners():uint { return slots.length; }
 		
-		/** @inheritDoc */
+		/**
+		 * @inheritDoc
+		 * @throws flash.errors.IllegalOperationError <code>IllegalOperationError</code>: You cannot addOnce() then add() the same listener without removing the relationship first.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 */
 		public function addOnce(listener:Function):ISlot
 		{
 			return registerListener(listener, true);
 			slots = SlotList.NIL;
 		}
 		
-		/** @inheritDoc */
+		/**
+		 * @inheritDoc
+		 * @throws ArgumentError <code>ArgumentError</code>: Incorrect number of arguments.
+		 * @throws ArgumentError <code>ArgumentError</code>: Value object is not an instance of the appropriate valueClasses Class.
+		 */
 		public function dispatch(...valueObjects):void
 		{
 			

src/org/osflash/signals/PrioritySignal.as

 			super(valueClasses);
 		}
 
-		/** @inheritDoc */
+		/**
+		 * @inheritDoc
+		 * @throws flash.errors.IllegalOperationError <code>IllegalOperationError</code>: You cannot addOnce() then add() the same listener without removing the relationship first.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 */
 		public function addWithPriority(listener:Function, priority:int = 0):ISlot 
 		{
 			return registerListenerWithPriority(listener, false, priority);
 		}
 
-		/** @inheritDoc */
+		/**
+		 * @inheritDoc
+		 * @throws flash.errors.IllegalOperationError <code>IllegalOperationError</code>: You cannot addOnce() then add() the same listener without removing the relationship first.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 */
 		public function addOnceWithPriority(listener:Function, priority:int = 0):ISlot 
 		{
 			return registerListenerWithPriority(listener, true, priority);

src/org/osflash/signals/Signal.as

 			super(valueClasses);
 		}
 		
-		/** @inheritDoc */
-		//TODO: @throws
+		/**
+		 * @inheritDoc
+		 * @throws flash.errors.IllegalOperationError <code>IllegalOperationError</code>: You cannot addOnce() then add() the same listener without removing the relationship first.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 */
 		public function add(listener:Function):ISlot
 		{
 			return registerListener(listener);

src/org/osflash/signals/Slot.as

 		 * @param once Whether or not the listener should be executed only once.
 		 * @param priority The priority of the slot.
 		 *
-		 * @throws ArgumentError An error is thrown if the given listener closure is <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 * @throws Error <code>Error</code>: Internal signal reference has not been set yet.
 		 */
 		public function Slot(listener:Function, signal:IOnceSignal, once:Boolean = false, priority:int = 0)
 		{
 
 		/**
 		 * @inheritDoc
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>. Did you want to set enabled to false instead?
+		 * @throws Error <code>Error</code>: Internal signal reference has not been set yet.
 		 */
 		public function get listener():Function
 		{

src/org/osflash/signals/SlotList.as

 		 *
 		 * @param head The first slot in the list.
 		 * @param tail A list containing all slots except head.
+		 * 
+		 * @throws ArgumentError <code>ArgumentError</code>: Parameters head and tail are null. Use the NIL element instead.
+		 * @throws ArgumentError <code>ArgumentError</code>: Parameter head cannot be null.
 		 */
 		public function SlotList(head:ISlot, tail:SlotList = null)
 		{
 		 * Prepends a slot to this list.
 		 * @param	slot The item to be prepended.
 		 * @return	A list consisting of slot followed by all elements of this list.
+		 * 
+		 * @throws ArgumentError <code>ArgumentError</code>: Parameter head cannot be null.
 		 */
 		public function prepend(slot:ISlot):SlotList
 		{
 			return wholeClone;
 		}		
 		
+		/**
+		 * Insert a slot into the list in a position according to its priority.
+		 * The higher the priority, the closer the item will be inserted to the list head.
+		 * @params slot The item to be inserted.
+		 * 
+		 * @throws ArgumentError <code>ArgumentError</code>: Parameters head and tail are null. Use the NIL element instead.
+		 * @throws ArgumentError <code>ArgumentError</code>: Parameter head cannot be null.
+		 */
 		public function insertWithPriority(slot:ISlot):SlotList
 		{
 			if (!nonEmpty) return new SlotList(slot);
 			return this;
 		}
 
+		/**
+		 * Determines whether the supplied listener Function is contained within this list
+		 */
 		public function contains(listener:Function):Boolean
 		{
 			if (!nonEmpty) return false;
 			return false;
 		}
 
+		/**
+		 * Retrieves the ISlot associated with a supplied listener within the SlotList.
+		 * @param   listener The Function being searched for
+		 * @return  The ISlot in this list associated with the listener parameter through the ISlot.listener property.
+		 *          Returns null if no such ISlot instance exists or the list is empty.  
+		 */
 		public function find(listener:Function):ISlot
 		{
 			if (!nonEmpty) return null;

src/org/osflash/signals/natives/INativeDispatcher.as

 		 * @throws	ArgumentError	<code>ArgumentError</code>: Event object is <code>null</code>.
 		 * @throws	ArgumentError	<code>ArgumentError</code>:	Event object [event] is not an instance of [eventClass].
 		 * @throws	ArgumentError	<code>ArgumentError</code>:	Event object has incorrect type. Expected [eventType] but was [event.type].
+		 * @throws  ArgumentError   <code>ArgumentError</code>:  Target object cannot be <code>null</code>.
 		 */
 		function dispatchEvent(event:Event):Boolean;
 	}

src/org/osflash/signals/natives/NativeMappedSignal.as

 
 		/**
 		 * @inheritDoc
+		 * @throws ArgumentError <code>ArgumentError</code>: Invalid valueClasses argument: item at index should be a Class but was not.
 		 */
 		override public function set valueClasses(value:Array):void
 		{
 		 * 
 		 * @param objectListOrFunction This can either be a list of object literals or a function that returns list of objects. 
 		 * @return The NativeMappedSignal object this method was called on. This allows the Signal to be defined and mapped in one statement.
+		 * @throws ArgumentError <code>ArgumentError</code>: Mapping function needs zero or one arguments of type Event
 		 */		
 		public function mapTo(...objectListOrFunction):NativeMappedSignal
 		{

src/org/osflash/signals/natives/NativeRelaySignal.as

 			eventClass = (value && value.length > 0) ? value[0] : null;
 		}
 		
-		// TODO: @throws
+		/**
+		 * @inheritDoc
+		 * @throws flash.errors.IllegalOperationError <code>IllegalOperationError</code>: You cannot addOnce() then add() the same listener without removing the relationship first.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Target object cannot be <code>null</code>.
+		 */
 		override public function add(listener:Function):ISlot
 		{
 			return addWithPriority(listener);
 		}
 
+		/**
+		 * @inheritDoc
+		 * @throws flash.errors.IllegalOperationError <code>IllegalOperationError</code>: You cannot addOnce() then add() the same listener without removing the relationship first.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Target object cannot be <code>null</code>.
+		 */
 		override public function addOnce(listener:Function):ISlot
 		{
 			return addOnceWithPriority(listener);
 		}
 
-		/** @inheritDoc */
+		/**
+		 * @inheritDoc
+		 * @throws flash.errors.IllegalOperationError <code>IllegalOperationError</code>: You cannot addOnce() then add() the same listener without removing the relationship first.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Target object cannot be <code>null</code>.
+		 */
 		public function addWithPriority(listener:Function, priority:int = 0):ISlot
 		{
 			return registerListenerWithPriority(listener, false, priority);
 		}
 
-		/** @inheritDoc */
+		/**
+		 * @inheritDoc
+		 * @throws flash.errors.IllegalOperationError <code>IllegalOperationError</code>: You cannot addOnce() then add() the same listener without removing the relationship first.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Target object cannot be <code>null</code>.
+		 */
 		public function addOnceWithPriority(listener:Function, priority:int = 0):ISlot
 		{
 			return registerListenerWithPriority(listener, true, priority);
 
 		/**
 		 * @inheritDoc
+		 * @throws ArgumentError <code>ArgumentError</code>: Event object expected.
+		 * @throws ArgumentError <code>ArgumentError</code>: No more than one Event object expected.
+		 * @throws ArgumentError <code>ArgumentError</code>: Target object cannot be <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Event object cannot be <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Event object [event] is not an instance of [eventClass].
+		 * @throws ArgumentError <code>ArgumentError</code>: Event object has incorrect type. Expected [eventType] but was [event.type].
 		 */
 		override public function dispatch(...valueObjects):void
 		{
 		 * Unlike other signals, NativeRelaySignal does not dispatch null
 		 * because it causes an exception in EventDispatcher.
 		 * @inheritDoc
+		 * @throws ArgumentError <code>ArgumentError</code>: Target object cannot be <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Event object cannot be <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Event object [event] is not an instance of [eventClass].
+		 * @throws ArgumentError <code>ArgumentError</code>: Event object has incorrect type. Expected [eventType] but was [event.type].
 		 */
 		public function dispatchEvent(event:Event):Boolean
 		{

src/org/osflash/signals/natives/NativeSignal.as

 			_target = value;
 		}
 		
-		/** @inheritDoc */
-		//TODO: @throws
+		/**
+		 * @inheritDoc
+		 * @throws flash.errors.IllegalOperationError <code>IllegalOperationError</code>: You cannot addOnce() then add() the same listener without removing the relationship first.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Target object cannot be <code>null</code>.
+		 */
 		public function add(listener:Function):ISlot
 		{
 			return addWithPriority(listener);
 		}
 		
-		/** @inheritDoc */
-		//TODO: @throws
+		/**
+		 * @inheritDoc
+		 * @throws flash.errors.IllegalOperationError <code>IllegalOperationError</code>: You cannot addOnce() then add() the same listener without removing the relationship first.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Target object cannot be <code>null</code>.
+		 */
 		public function addWithPriority(listener:Function, priority:int = 0):ISlot
 		{
 			return registerListenerWithPriority(listener, false, priority);
 		}
 		
-		/** @inheritDoc */
+		/**
+		 * @inheritDoc
+		 * @throws flash.errors.IllegalOperationError <code>IllegalOperationError</code>: You cannot addOnce() then add() the same listener without removing the relationship first.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Target object cannot be <code>null</code>.
+		 */
 		public function addOnce(listener:Function):ISlot
 		{
 			return addOnceWithPriority(listener);
 		}
 		
-		/** @inheritDoc */
+		/**
+		 * @inheritDoc
+		 * @throws flash.errors.IllegalOperationError <code>IllegalOperationError</code>: You cannot addOnce() then add() the same listener without removing the relationship first.
+		 * @throws ArgumentError <code>ArgumentError</code>: Given listener is <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Target object cannot be <code>null</code>.
+		 */
 		public function addOnceWithPriority(listener:Function, priority:int = 0):ISlot
 		{
 			return registerListenerWithPriority(listener, true, priority);
 			slots = SlotList.NIL;
 		}
 
-		/** @inheritDoc */
+		/**
+		 * @inheritDoc
+		 * @throws ArgumentError <code>ArgumentError</code>: Event object expected.
+		 * @throws ArgumentError <code>ArgumentError</code>: No more than one Event object expected.
+		 * @throws ArgumentError <code>ArgumentError</code>: Target object cannot be <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Event object cannot be <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Event object [event] is not an instance of [eventClass].
+		 * @throws ArgumentError <code>ArgumentError</code>: Event object has incorrect type. Expected [eventType] but was [event.type].
+		 */
 		public function dispatch(...valueObjects):void
 		{
 			//TODO: check if ...valueObjects can ever be null.
 		 * Unlike other signals, NativeSignal does not dispatch null
 		 * because it causes an exception in EventDispatcher.
 		 * @inheritDoc
+		 * @throws ArgumentError <code>ArgumentError</code>: Target object cannot be <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Event object cannot be <code>null</code>.
+		 * @throws ArgumentError <code>ArgumentError</code>: Event object [event] is not an instance of [eventClass].
+		 * @throws ArgumentError <code>ArgumentError</code>: Event object has incorrect type. Expected [eventType] but was [event.type].
 		 */
 		public function dispatchEvent(event:Event):Boolean
 		{

src/org/osflash/signals/natives/sets/NativeSignalSet.as

 
 		/**
 		 * Lazily instantiates a NativeSignal
+		 * @throws ArgumentError <code>ArgumentError</code>: eventType must not be null.
 		 */
 		public function getNativeSignal(eventType:String, eventClass:Class = null):NativeSignal 
 		{