/**
 * Takes a single string from a publisher notification and uses it as the key for
 * a mapping of parameters to use in propagating the notification to a specified subscriber.
 *
 * Requires:
 *	Properties.js
 */
function SubscriberParameterMapper(itsSubscriber,itsNotificationFunction,itsParameterIndex)
{
	var itsParameterMappings = new Properties();


	Publisher(this);


	this.addMapping = function(inNotificationValue)
	{
		var theParameters;

		theParameters = Array.prototype.slice.apply(arguments,[1]);
		// Leave a placeholder for the publisher parameter
		theParameters[theParameters.length] = undefined;
		itsParameterMappings.setProperty(inNotificationValue,theParameters);
	};


	this.publisherChanged = function()
	{
		var theParameters;

		theParameters = itsParameterMappings.getProperty(arguments[itsParameterIndex]);
		if (!theParameters)
			return;
		theParameters[theParameters.length - 1] = arguments[arguments.length + 1];
		itsNotificationFunction.apply(itsSubscriber,theParameters);
	}
}
