public CommandResult execute(Realm realm) {
if (populationContainer.canContainPopulation()) {
int weightPerCitizen = Integer.parseInt(realm.getProperty("weight_per_citizen"));
if (populationContainer.getRemainingCapacity() >= (population - populationContainer.getContainedPopulation()) * weightPerCitizen) {
populationContainer.setContainedPopulation(population);
return new CommandResult(CommandResult.RESULT_OK, "");
} else {
return new CommandResult(CommandResult.RESULT_ERROR, "Not enough capacity");
}
} else {
return new CommandResult(CommandResult.RESULT_ERROR, "Container can not carry population");
}
}