break;
case VAR_BREED:
if (value instanceof AgentSet) {
AgentSet breed = (AgentSet) value;
if (breed != world.links() && !world.isLinkBreed(breed)) {
throw new AgentException(I18N.errorsJ().get("org.nlogo.agent.Link.cantSetBreedToNonLinkBreedAgentSet"));
}
if (world.getLink(end1.agentKey(), end2.agentKey(), breed) != null) {
throw new AgentException("there is already a "
+ world.getLinkBreedSingular(breed)
+ " with endpoints "
+ end1.toString() + " and " + end2.toString());
}
if (!world.linkManager.checkBreededCompatibility(breed == world.links())) {
throw new AgentException
(I18N.errorsJ().get("org.nlogo.agent.Link.cantHaveBreededAndUnbreededLinks"));
}
setBreed(breed);
} else {
wrongTypeForVariable(AgentVariables.getImplicitLinkVariables()[vn],
AgentSet.class, value);
}
break;
case VAR_THICKNESS:
if (value instanceof Double) {
lineThickness((Double) value);
} else {
wrongTypeForVariable(AgentVariables.getImplicitLinkVariables()[vn],
Double.class, value);
}
break;
case VAR_SHAPE:
if (value instanceof String) {
String newShape = world.checkLinkShapeName((String) value);
if (newShape == null) {
throw new AgentException(I18N.errorsJ().getN("org.nlogo.agent.Agent.shapeUndefined", value));
}
shape(newShape);
} else {
wrongTypeForVariable(AgentVariables.getImplicitLinkVariables()[vn],
String.class, value);
}
break;
case VAR_TIEMODE:
if (value instanceof String) {
mode((String) value);
} else {
wrongTypeForVariable(AgentVariables.getImplicitLinkVariables()[vn],
String.class, value);
}
break;
case VAR_END1:
case VAR_END2:
throw new AgentException("you can't change a link's endpoints");
default:
break;
}
}
world.notifyWatchers(this, vn, value);