namespace ca.mcgill.ecse321.treeple.model;

class TreePLESystem {
  public void reinitialize() { 
		Resident.reinitializeAutouniqueNumber(this.getResidents());
	 	Tree.reinitializeAutouniqueNumber(this.getTrees()); 
	 	Municipality.reinitializeUniqueName(this.getMunicipalities());
	}
}

class Resident {
	public static void reinitializeAutouniqueNumber(List<Resident> residents) { 
		nextId = 0;
		for (Resident resident : residents) {
		if (resident.getId() > nextId) {
			nextId = resident.getId(); }
		}
		nextId++;
	}
}

class Tree {
	public static void reinitializeAutouniqueNumber(List<Tree> trees) { 
		nextId = 0;
		for (Tree tree : trees) {
		if (tree.getId() > nextId) {
			nextId = tree.getId(); }
		}
		nextId++;
	}
}

class Municipality {
	public static void reinitializeUniqueName(List<Municipality> municipalities) { 
		municipalitysByName = new HashMap<String, Municipality>();
		for (Municipality municipality : municipalities) {
			municipalitysByName.put(municipality.getName(), municipality); 
		}
	}
}