sample/SleepingBarber/Problem.js
function clientsGenerator()
{
  var i = 0,
    len = clientsList.length;

  for( ; i < len; i++ )
  {
    var client = { name : clientsList[ i ].name };
    var time = _.timeNow();
    setTimeout(( function( client, time )
    {
      /* sending clients to shop */
      this.barberShopArrive( client, time );
    }).bind( this, client, time ), clientsList[ i ].arrivedTime );
  }
}
function clientsGenerator()
{
  var i = 0,
    len = clientsList.length;

  for( ; i < len; i++ )
  {
    var client = { name : clientsList[ i ].name };
    var time = _.timeNow();
    setTimeout(( function( client, time )
    {
      /* sending clients to shop */
      this.barberShopArrive( client, time );
    }).bind( this, client, time ), clientsList[ i ].arrivedTime );
  }
}
function clientsGenerator ( ) { var i = 0 , len = clientsList . length ; for ( ; i < len ; i ++ ) { var client = { name : clientsList [ i ] . name } ; var time = _ . timeNow ( ) ; setTimeout ( ( function ( client , time ) { /* sending clients to shop */ this . barberShopArrive ( client , time ) ; } ) . bind ( this , client , time ) , clientsList [ i ] . arrivedTime ) ; } }
Used to simulate clients visiting hairdresser
@param {wConsequence} con - this parameter represent sequence of clients that go to barber shop
@returns {wConsequence}
Used to simulate clients visiting hairdresser