}
public AgentSet report_1(Context context, Object agentOrSet)
throws LogoException {
List<Turtle> resultList = new ArrayList<Turtle>();
AgentSet breed = world.getBreed(breedName);
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()));
}
for (Turtle t : turtle.getPatchHere().turtlesHere()) {
if (t.getBreed() == breed) {
resultList.add(t);
}
}
} else if (agentOrSet instanceof Patch) {
for (Turtle turtle : ((Patch) agentOrSet).turtlesHere()) {
if (turtle.getBreed() == breed) {
resultList.add(turtle);
}
}
} else if (agentOrSet instanceof AgentSet) {
AgentSet sourceSet = (AgentSet) agentOrSet;
if (sourceSet.type() == Turtle.class) {
for (AgentSet.Iterator iter = sourceSet.iterator(); iter.hasNext();) {
for (Turtle turtle : ((Turtle) iter.next()).getPatchHere().turtlesHere()) {
if (turtle.getBreed() == breed) {
resultList.add(turtle);
}
}
}
} else if (sourceSet.type() == Patch.class) {
for (AgentSet.Iterator iter = sourceSet.iterator(); iter.hasNext();) {
for (Turtle turtle : ((Patch) iter.next()).turtlesHere()) {
if (turtle.getBreed() == breed) {
resultList.add(turtle);
}
}