/* Changes the size of the Gateway Node. */
  private void manipulateSplit(
      CanonicalProcessType cpf,
      AnnotationsType anf,
      GraphicsType splitGraphicsType,
      NodeType splitNode) {
    int index;
    BigDecimal newX, newY;
    PositionType position;
    GraphicsType targetAnn, targetEdgeAnn;
    SplitType split = (SplitType) splitNode;

    BigDecimal oldH = splitGraphicsType.getSize().getHeight();
    BigDecimal oldW = splitGraphicsType.getSize().getWidth();
    BigDecimal oldX = splitGraphicsType.getPosition().get(0).getX();
    BigDecimal oldY = splitGraphicsType.getPosition().get(0).getY();

    Map<EdgeType, NodeType> targets = findSplitNodeTargets(cpf, split.getId());
    for (Map.Entry<EdgeType, NodeType> target : targets.entrySet()) {
      targetAnn = findGraphicsType(anf, target.getValue().getId());
      targetEdgeAnn = findGraphicsType(anf, target.getKey().getId());

      if (targetAnn != null) {
        newX =
            targetAnn
                .getSize()
                .getWidth()
                .divide(divisor)
                .add(targetAnn.getPosition().get(0).getX());
        newY = targetAnn.getPosition().get(0).getY();

        index = 0;
        for (PositionType targetEdgePos : targetEdgeAnn.getPosition()) {
          if (!((targetEdgePos.getX().compareTo(oldX) > 0)
              && (targetEdgePos.getX().compareTo(oldX.add(oldW)) < 0)
              && (targetEdgePos.getY().compareTo(oldY) > 0)
              && (targetEdgePos.getY().compareTo(oldY.add(oldH)) < 0))) {
            position = new PositionType();
            position.setX(newX);
            position.setY(newY);

            targetEdgeAnn.getPosition().set(index, position);
          }
          index++;
        }
      }
    }
  }
  /* Changes the position of the edges X and Y. */
  private Map<PositionType, PositionType> changeLocation(
      GraphicsType graphicsType, AnnotationData annData) {
    int index = 0;
    PositionType newPos = new PositionType();
    Map<PositionType, PositionType> replace = new HashMap<>();

    for (PositionType pos : graphicsType.getPosition()) {
      if ((pos.getX().compareTo(annData.getOldX()) >= 0)
          && (pos.getX().compareTo(annData.getOldX().add(annData.getOldW())) <= 0)
          && (pos.getY().compareTo(annData.getOldY()) >= 0)
          && (pos.getY().compareTo(annData.getOldY().add(annData.getOldH())) <= 0)) {
        newPos.setX(annData.getNewX().add(annData.getNewW().divide(divisor)));
        newPos.setY(annData.getNewY().add(annData.getNewH().divide(divisor)));
        graphicsType.getPosition().set(index, newPos);
      }
      index++;
    }

    return replace;
  }