Exemple #1
0
 public void setGuiActive() {
   for (MyTenant t : tenants) {
     if (t.maintenance) {
       t.house.getAnimationPanel().addGui(gui);
     }
   }
   gui.setPresent(true);
 }
Exemple #2
0
 private void fixAppliance(final MyTenant mt) {
   System.out.println("Time for me to fix the appliance");
   if (!test) {
     log("Going to fix a tenant's appliance.");
   }
   final String temp = mt.needsMaintenance.remove(0);
   if (!test) {
     PersonTask pt = new PersonTask("goToApartment");
     p.DoGoTo(mt.tenant.getHouse().getName(), pt);
     if (temp.equals("Stove")) {
       gui.goToStove();
     } else if (temp.equals("Oven")) {
       gui.goToOven();
     } else if (temp.equals("Microwave")) {
       gui.goToStove();
     }
     try {
       atDest.acquire();
     } catch (InterruptedException e) {
     }
   }
   fix.schedule(
       new TimerTask() {
         @Override
         public void run() {
           System.out.println("sending msg fixed");
           mt.tenant.msgFixed(temp);
           mt.maintenance = false;
           if (!test) {
             log("All fixed, time to go home");
             gui.goToExit();
             try {
               atDest.acquire();
             } catch (InterruptedException e) {
             }
             gui.setPresent(false);
             mt.house.getAnimationPanel().notInHouse(gui);
             setRoleInactive = true;
           }
           p.stateChanged();
           return;
         }
       },
       4000);
 }