/** * Adds the specified {@link VisualVertex} to the Grid. * * @param visualVertex The VisualVertex to add * @return <code>true</code> if the VisualVertex was added successfully to this Grid, <code>false * </code> otherwise */ boolean addVisualVertexToGrid(VisualVertex visualVertex) { int positionX = visualVertex.getGridPoint().getPositionX(); int positionY = visualVertex.getGridPoint().getPositionY(); // Early negative return if specified GridPoint is invalid if (!Validation.isValidGridPoint( visualVertex.getGridPoint(), this.horizontalGridPoints, this.verticalGridPoints)) { return false; } // Get VisualVertex at specified GridPoint VisualVertex visualVertexAtGridPoint = this.grid[positionX][positionY]; // Return false if GridPoint is not empty if (visualVertexAtGridPoint != null) { return false; } // Add VisualVertex this.grid[positionX][positionY] = visualVertex; return true; }