Exemplo n.º 1
0
  public Activity activateIn(Swarm context) {
    super.activateIn(context);

    // Now activate our schedule in ourselves.
    // This arranges for the excution of the schedule we built.

    displaySchedules.activateIn(this);

    // Activate returns the swarm activity

    return getActivity();
  }
Exemplo n.º 2
0
  public Object buildActions() {

    // Create an ActionGroup for display
    displayActions = new ActionGroupImpl(this);

    // Schedule up the methods to draw the display of the world
    try {
      displayActions.createActionTo$message(
          valueDisplay, new Selector(valueDisplay.getClass(), "display", false));
      displayActions.createActionTo$message(
          worldRaster, new Selector(worldRaster.getClass(), "drawSelf", false));
      displayActions.createActionTo$message(
          conwayWorld, new Selector(conwayWorld.getClass(), "stepRule", false));
      displayActions.createActionTo$message(
          getActionCache(), new Selector(getActionCache().getClass(), "doTkEvents", true));
    } catch (Exception e) {
      System.err.println("Exception: " + e.getMessage());
      System.exit(1);
    }
    displaySchedules = new ScheduleImpl(this, displayFrequency);
    displaySchedules.at$createAction(0, displayActions);

    return this;
  }