Beispiel #1
0
		public void addAction( Action action )
		{
			var actionId = findActionIndex( action );
			if( actionId == -1 )
				throw new KeyNotFoundException( "could not find or create Action" );

			foreach( var preCondition in action._preConditions )
			{
				var conditionId = findConditionNameIndex( preCondition.Item1 );
				if( conditionId == -1 )
					throw new KeyNotFoundException( "could not find or create conditionName" );

				_preConditions[actionId].set( conditionId, preCondition.Item2 );
			}

			foreach( var postCondition in action._postConditions )
			{
				var conditionId = findConditionNameIndex( postCondition.Item1 );
				if( conditionId == -1 )
					throw new KeyNotFoundException( "could not find conditionName" );

				_postConditions[actionId].set( conditionId, postCondition.Item2 );
			}
		}
Beispiel #2
0
		internal int findActionIndex( Action action )
		{
			var idx = _actions.IndexOf( action );
			if( idx > -1 )
				return idx;

			_actions.Add( action );

			return _actions.Count - 1;
		}