<commit_before>package org.servebox.cafe.core.command
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	import org.servebox.cafe.core.signal.SignalAggregator;
	
	public class AbstractStateCommand extends EventDispatcher implements IStateCommand
	{
		public function AbstractStateCommand(target:IEventDispatcher=null)
		{
			super(target);
		}
		
		[Autowired]
		public var signalAggregator : SignalAggregator;
		
		private var _parameters : Array;
		
		public function get executable():Boolean
		{
			return true;
		}
		
		public function set executable(value:Boolean):void
		{
		}
		
		public function get parameters():Array
		{
			if ( _parameters == null )
			{
				_parameters = new Array();
			}
			return _parameters;
		}
		
		public function set parameters(value:Array):void
		{
			_parameters = value;
		}		
		
		protected function getParameter( key : String ) : IParameterObject
		{
			var paramToReturn : IParameterObject;
			for each ( var param : IParameterObject in _parameters )
			{
				if ( param.key == key )
				{
					paramToReturn = param;
				}
			}
			if ( !paramToReturn )
			{
				throw new Error("No parameter " + key + " in " + this + " command, check command binding ");
			}
			return paramToReturn;
		}
		
		public function addParameter( key : String , value : Object ) : void
		{
			var param : AbstractParameterObject = new AbstractParameterObject( key, value );
			parameters.push( param );
		}<commit_msg>Add throw error for parameter value.<commit_after>package org.servebox.cafe.core.command
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	import org.servebox.cafe.core.signal.SignalAggregator;
	
	public class AbstractStateCommand extends EventDispatcher implements IStateCommand
	{
		public function AbstractStateCommand(target:IEventDispatcher=null)
		{
			super(target);
		}
		
		[Autowired]
		public var signalAggregator : SignalAggregator;
		
		private var _parameters : Array;
		
		public function get executable():Boolean
		{
			return true;
		}
		
		public function set executable(value:Boolean):void
		{
		}
		
		public function get parameters():Array
		{
			if ( _parameters == null )
			{
				_parameters = new Array();
			}
			return _parameters;
		}
		
		public function set parameters(value:Array):void
		{
			_parameters = value;
		}		
		
		protected function getParameter( key : String ) : IParameterObject
		{
			var paramToReturn : IParameterObject;
			for each ( var param : IParameterObject in _parameters )
			{
				if ( param.key == key )
				{
					paramToReturn = param;
					if ( paramToReturn.value == null )
					{
						throw new Error("Parameter value for " + key + " in " + this + " is null, check command binding ");
					}
				}
			}
			if ( !paramToReturn )
			{
				throw new Error("No parameter " + key + " in " + this + " command, check command binding ");
			}
			return paramToReturn;
		}
		
		public function addParameter( key : String , value : Object ) : void
		{
			var param : AbstractParameterObject = new AbstractParameterObject( key, value );
			parameters.push( param );
		}
{'fraction_non_alphanumeric': 0.09185278389430639, 'fraction_numerical': 0.0, 'mean_word_length': 3.200792602377807, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3960784', 'n_tokens_mistral': 1136, 'n_tokens_neox': 901, 'n_words': 243}