// MESSAGES public void msgCollectRent() { log.add(new LoggedEvent("Recieved msgEndOfDay, all tenants now should have rent due")); if (!test) { log("Time to collect rent from all of my tenants!"); } synchronized (tenants) { for (MyTenant t : tenants) { t.numOutstandingPayments++; t.newPayment = true; if (t.numOutstandingPayments > 0) { t.paymentsUpToDate = false; } } } this.p.stateChanged(); }
public void msgFixAppliance(Person p, String a) { log.add( new LoggedEvent( "Recieved msgFixAppliance from tenant, tenant should now have " + a + " in needsMaintenance")); synchronized (tenants) { for (MyTenant t : tenants) { if (t.tenant.equals(p)) { t.needsMaintenance.add(a); t.maintenance = true; } } } this.p.stateChanged(); }
public void msgHereIsMyRent( Person p, double amount) { // for the normative scenario, assuming tenant always pays correct amount for // rent log.add( new LoggedEvent( "Recieved msgHereIsMyRent from tenant, tenant should now have no outstanding payments due")); if (!test) { log("Yay, " + p.getName() + " payed their rent!"); } earnings += amount; synchronized (tenants) { for (MyTenant t : tenants) { if (t.tenant.equals(p)) { t.numOutstandingPayments--; if (t.numOutstandingPayments <= 0) { t.paymentsUpToDate = true; } } } } this.p.stateChanged(); }
private void log(String msg) { print(msg); ActivityLog.getInstance().logActivity(tag, msg, name, false); log.add(new LoggedEvent(msg)); }