// (c) 2007 KystAtlas AS (Hans Martin Mohn)

gtAssert("gtEventHandler != null");gtWaitForAll.prototype=new gtEventHandler()
function gtWaitForAll()
{this.addHandler(arguments[0]);this.m_conditions=new Array();for(var i=1;i<arguments.length;i++)
this.m_conditions.push(arguments[i]);}
gtWaitForAll.prototype.setEventArgument=function setEventArgument(index,value)
{if(this.m_args===null)
this.m_args=new Array();this.m_args[index]=value;};gtWaitForAll.prototype.signal=function signal(name)
{for(var i=0;i<this.m_conditions.length;i++)
{if(this.m_conditions[i]==name)
{this.m_conditions.splice(i,1);if(this.m_conditions.length===0)
{if(this.m_args)
this.raise(this.m_args[0],this.m_args[1],this.m_args[2],this.m_args[3],this.m_args[4],this.m_args[5],this.m_args[6],this.m_args[7],this.m_args[8],this.m_args[9]);else
this.raise();}
return true;}}
return false;};gtWaitForAll.prototype.reset=function reset()
{this.m_conditions=new Array();for(var i=0;i<arguments.length;i++)
this.m_conditions.push(arguments[i]);};