001package agent.one; 002import agent.Agent; 003import agent.TimeServer; 004import agent.TimeServerLinked; 005 006public class Main { 007 public static void main (String[] args) { 008 TimeServer time = new TimeServerLinked(); 009 Agent a = new Tiger(time); 010 time.enqueue(0,a); 011 time.run(100); 012 } 013} 014 015class Tiger implements Agent { 016 private TimeServer time; 017 public Tiger(TimeServer time) { this.time = time; } 018 public void run() { 019 System.out.println("It's " + time.currentTime() + " and I'm alive!"); 020 time.enqueue(10+time.currentTime(), this); 021 } 022}