/** * Removes a Town from the Datasource * * @param town */ public boolean removeTown(Town town) { boolean result = towns.remove(town.getName()) != null; for (Nation n : nations.values()) if (n.hasTown(town)) n.removeTown(town); for (Resident r : town.getResidents()) r.removeResidentFromTown(town); return result; }
/** * Removes a Nation from the Datasource * * @param nation */ public boolean removeNation(Nation nation) { boolean result = nations.remove(nation.getName()) != null; for (Town t : towns.values()) if (t.hasNation(nation)) t.removeNation(nation); return result; }
/** * Adds a Nation to the Datasource * * @param nation */ public void addNation(Nation nation) throws Exception { nations.put(nation.getName(), nation); }