110 likes | 282 Views
boris - additional. timers, scope & brokering. Simon Lynch s.c.lynch@tees.ac.uk. timers. why, what & how? agent timers countdown timers alarm timers. agent timers. Agent a = new Agent( name ); a.addAgentTimerListener( new AgentTimerListener() { public void timerElapsed( Agent a )
E N D
boris - additional timers, scope & brokering Simon Lynch s.c.lynch@tees.ac.uk
timers why, what & how? • agent timers • countdown timers • alarm timers
agent timers Agent a = new Agent( name ); a.addAgentTimerListener( new AgentTimerListener() { public void timerElapsed( Agent a ) { ...code body... } }); a.setDelay( delay ); ... a.start(); ... a.stop(); ...
the ball example Agent a = new Agent( "anon" ); a.addAgentTimerListener( new AgentTimerListener() { public void timerElapsed( Agent a ) { erase(); x = (x+dx) % bounds; y = (y+dy) % bounds; display(); } }); a.setDelay( delay ); display(); a.start(); }
a countdown timer Agent a = new Agent( name ); a.addAgentTimerListener( new AgentTimerListener() { public void timerElapsed( Agent a ) { if( coundown-elapsed ) { a.stop(); switchOff(); } else { ...code body... } } }); a.setDelay( delay ); switchOn(); a.start();
alarm timer given: Calendar alarmTime... Agent a = new Agent( name ); a.addAgentTimerListener( new AgentTimerListener() { public void timerElapsed( Agent a ) { a.stop(); alarmOn(); } }); long alarmMS = alarmTime.getTime().getTime(); long nowMS = new Date().getTime(); a.setDelay( alarmMS – nowMS ); if (delay > 0 ) a.start(); else alarmOn();
scope why, what & how? • MAS partitions • holons • reduced complexity • tailored partitions (eg: localised brokers) • enhanced security
scope in Boris why, what & how? • internal - behind portal • local - behind router • global - the default
scope in Boris why, what & how? portal.addAgent( agent ) portal.addAgent( agent, Portal.INTERNAL ) portal.addAgent( agent, Portal.LOCAL )
Brokers yellow pages agents • some are localised (in holons, etc) • some keep record of providers • need for central service? in boris / java • map agents to services • services to agents • etc