return super.toString() + ":" + breedName + ",+" + offset;
}
@Override
public void perform(final Context context) throws LogoException {
Turtle dest = argEvalTurtle(context, 0);
Turtle src = (Turtle) context.agent;
AgentSet breed = breedName == null ? world.links() : world.getLinkBreed(breedName);
mustNotBeDirected(breed, context);
checkForBreedCompatibility(breed, context);
if (breed == world.links()) {
breed.setDirected(false);
}
if (world.linkManager.findLinkEitherWay(src, dest, breed, false) == null) {
if (src == dest) {
throw new EngineException
(context, this,
I18N.errorsJ().get("org.nlogo.prim.$common.turtleCantLinkToSelf"));
}
if (src.id > dest.id) {
Turtle tmp = src;
src = dest;
dest = tmp;
}
if (src.id != -1 && dest.id != -1) {
Link link = world.linkManager.createLink(src, dest, breed);