package sample;
import java.util.Collection;
import java.util.EnumSet;
import rescuecore2.worldmodel.ChangeSet;
import rescuecore2.messages.Command;
import rescuecore2.log.Logger;
import rescuecore2.standard.components.StandardAgent;
import rescuecore2.standard.entities.Building;
import rescuecore2.standard.entities.StandardEntityURN;
/**
A sample centre agent.
*/
public class SampleCentre extends StandardAgent<Building> {
@Override
public String toString() {
return "Sample centre";
}
@Override
protected void think(int time, ChangeSet changed, Collection<Command> heard) {
if (time == config.getIntValue(kernel.KernelConstants.IGNORE_AGENT_COMMANDS_KEY)) {
// Subscribe to channels 1 and 2
sendSubscribe(time, 1, 2);
}
for (Command next : heard) {
Logger.debug("Heard " + next);
}
sendRest(time);
}
@Override
protected EnumSet<StandardEntityURN> getRequestedEntityURNsEnum() {
return EnumSet.of(StandardEntityURN.FIRE_STATION,
StandardEntityURN.AMBULANCE_CENTRE,
StandardEntityURN.POLICE_OFFICE);
}
}