public void deleteAgent(Agent a) { synchronized (Node.class) { for (Agent x : getCurrentAgents()) { if (x.equals(a)) { getCurrentAgents().remove(x); } } } }
public void run() { flag = true; Agent a; int n = agents.size(); for (int i = 0; i < n && flag; i++) { a = agents.get(i); a.live(); Thread t = new Thread(a); a.setThread(t); t.start(); } }