@Override /** réinitialise la position des balles */ public void restart() { for (int i = 0; i < this.boids.length; i++) { this.boids[i].setDate(0); this.boids[i].execute(); } jeu.reset(); for (int j = 0; j < this.boids.length; j++) { for (int i = 0; i < boids[j].getLength(); i++) { jeu.addGraphicalElement( new Oval( this.boids[j].getX(i), this.boids[j].getY(i), this.boids[j].getColor(), this.boids[j].getColor(), 10, 10)); } } }
@Override /** passe une étape (translation) et réaffiche les boids */ public void next() { EventManager manager = boids[0].getManager(); long max = manager.nextMaxDate(); while (manager.getCurrentDate() <= max) { manager.next(); } jeu.reset(); for (int j = 0; j < this.boids.length; j++) { for (int i = 0; i < boids[j].getLength(); i++) { jeu.addGraphicalElement( new Oval( this.boids[j].getX(i), this.boids[j].getY(i), this.boids[j].getColor(), this.boids[j].getColor(), 10, 10)); } } }