01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
package myproject.model;

/**
 * A light has a boolean state.
 */
public class Light implements Agent {
  Light() { } // Created only by this package

  private boolean state;

  public boolean getState() {
    return state;
  }
  public void run(double time) {
    if (time%40==0) {
      state = !state;
    }
  }
}