void createVertex(int x, int y) {
    for (Vertex vertex : allVertexes) {
      if (vertex.checkPosition(x, y)) {
        return;
      }
    }

    Vertex newVertex = new Vertex("N" + x + "_" + y, x, y);
    allVertexes.add(newVertex);

    for (Vertex checkVertex : allVertexes) {
      int diffX = Math.abs(checkVertex.getxPosition() - newVertex.getxPosition());
      int diffY = Math.abs(checkVertex.getyPosition() - newVertex.getyPosition());

      if ((diffX == 1) != (diffY == 1)) {
        if ((diffX == 0) != (diffY == 0)) {
          checkVertex.addAdjacentVertex(newVertex);
        }
      }
    }
  }
  public synchronized boolean deleteTile(int x, int y) {
    Station tempStation = null;
    for (Station station : allStations) {
      if (station.checkPosition(x, y)) {
        tempStation = station;
        break;
      }
    }
    allStations.remove(tempStation);

    Vertex tempVertex = null;
    for (Vertex vertex : allVertexes) {
      if (vertex.checkPosition(x, y)) {
        tempVertex = vertex;
        break;
      }
    }
    allVertexes.remove(tempVertex);

    return true;
  }
  synchronized void toggleAdjecent(int x, int y) {

    Vertex tempAdjecentVertex = null;
    for (Vertex adjecentVertex : selectedVertex.getAdjacencyList()) {
      if (adjecentVertex.getxPosition() == x && adjecentVertex.getyPosition() == y) {
        tempAdjecentVertex = adjecentVertex;
        break;
      }
    }

    if (tempAdjecentVertex != null) {
      selectedVertex.getAdjacencyList().remove(tempAdjecentVertex);
      return;
    }

    Vertex tempNewAdjecentVertex = null;
    for (Vertex vertex : allVertexes) {
      if (vertex.checkPosition(x, y)) {
        tempNewAdjecentVertex = vertex;
      }
    }
    selectedVertex.getAdjacencyList().add(tempNewAdjecentVertex);
  }
  void selectTile(int x, int y) {
    selectedVertex = null;
    selectedStation = null;
    for (Vertex vertex : allVertexes) {
      if (vertex.checkPosition(x, y)) {
        selectedVertex = vertex;
        break;
      }
    }

    for (Station station : allStations) {
      if (station.checkPosition(x, y)) {
        selectedStation = station;
        break;
      }
    }

    if (selectedVertex != null) {
      this.mapMakerView.getShowDataPanel().getNewPodcarButton().setEnabled(true);
    } else {
      this.mapMakerView.getShowDataPanel().getNewPodcarButton().setEnabled(false);
    }
  }