List<Turtle> resultList = new ArrayList<Turtle>();
if (agentOrSet instanceof Turtle) {
Turtle turtle = (Turtle) agentOrSet;
if (turtle.id == -1) {
throw new EngineException(context, this,
I18N.errorsJ().getN("org.nlogo.$common.thatAgentIsDead", turtle.classDisplayName()));
}
addAll(resultList, turtle.getPatchHere().turtlesHere());
} else if (agentOrSet instanceof Patch) {
addAll(resultList, ((Patch) agentOrSet).turtlesHere());
} else if (agentOrSet instanceof AgentSet) {