public void update() {
    initializeLink(0);

    source.updateAnchors();
    target.updateAnchors();

    link.setStartAnchor(source.getAnchor(sourceAnchorKey));
    link.setEndAnchor(target.getAnchor(targetAnchorKey));
    link.setLabel(pattern);
    link.setSelfLoop(source == target);

    link.update();
  }