style: enable ParameterName in CheckStyle. (#5196)

* Enabled: ParameterName in CheckStyle.

* Refactored to fix  bug caused by selfAssignment of variables in VectorCrossproduct class
This commit is contained in:
Godwill Christopher
2024-05-31 14:01:11 -06:00
committed by GitHub
parent 2568b96784
commit c42b1c940c
23 changed files with 139 additions and 139 deletions

View File

@@ -12,44 +12,44 @@ public final class BoundaryFill {
* Get the color at the given co-odrinates of a 2D image
*
* @param image The image to be filled
* @param x_co_ordinate The x co-ordinate of which color is to be obtained
* @param y_co_ordinate The y co-ordinate of which color is to be obtained
* @param xCoordinate The x co-ordinate of which color is to be obtained
* @param yCoordinate The y co-ordinate of which color is to be obtained
*/
public static int getPixel(int[][] image, int x_co_ordinate, int y_co_ordinate) {
return image[x_co_ordinate][y_co_ordinate];
public static int getPixel(int[][] image, int xCoordinate, int yCoordinate) {
return image[xCoordinate][yCoordinate];
}
/**
* Put the color at the given co-odrinates of a 2D image
*
* @param image The image to be filed
* @param x_co_ordinate The x co-ordinate at which color is to be filled
* @param y_co_ordinate The y co-ordinate at which color is to be filled
* @param xCoordinate The x co-ordinate at which color is to be filled
* @param yCoordinate The y co-ordinate at which color is to be filled
*/
public static void putPixel(int[][] image, int x_co_ordinate, int y_co_ordinate, int new_color) {
image[x_co_ordinate][y_co_ordinate] = new_color;
public static void putPixel(int[][] image, int xCoordinate, int yCoordinate, int newColor) {
image[xCoordinate][yCoordinate] = newColor;
}
/**
* Fill the 2D image with new color
*
* @param image The image to be filed
* @param x_co_ordinate The x co-ordinate at which color is to be filled
* @param y_co_ordinate The y co-ordinate at which color is to be filled
* @param new_color The new color which to be filled in the image
* @param boundary_color The old color which is to be replaced in the image
* @param xCoordinate The x co-ordinate at which color is to be filled
* @param yCoordinate The y co-ordinate at which color is to be filled
* @param newColor The new color which to be filled in the image
* @param boundaryColor The old color which is to be replaced in the image
*/
public static void boundaryFill(int[][] image, int x_co_ordinate, int y_co_ordinate, int new_color, int boundary_color) {
if (x_co_ordinate >= 0 && y_co_ordinate >= 0 && getPixel(image, x_co_ordinate, y_co_ordinate) != new_color && getPixel(image, x_co_ordinate, y_co_ordinate) != boundary_color) {
putPixel(image, x_co_ordinate, y_co_ordinate, new_color);
boundaryFill(image, x_co_ordinate + 1, y_co_ordinate, new_color, boundary_color);
boundaryFill(image, x_co_ordinate - 1, y_co_ordinate, new_color, boundary_color);
boundaryFill(image, x_co_ordinate, y_co_ordinate + 1, new_color, boundary_color);
boundaryFill(image, x_co_ordinate, y_co_ordinate - 1, new_color, boundary_color);
boundaryFill(image, x_co_ordinate + 1, y_co_ordinate - 1, new_color, boundary_color);
boundaryFill(image, x_co_ordinate - 1, y_co_ordinate + 1, new_color, boundary_color);
boundaryFill(image, x_co_ordinate + 1, y_co_ordinate + 1, new_color, boundary_color);
boundaryFill(image, x_co_ordinate - 1, y_co_ordinate - 1, new_color, boundary_color);
public static void boundaryFill(int[][] image, int xCoordinate, int yCoordinate, int newColor, int boundaryColor) {
if (xCoordinate >= 0 && yCoordinate >= 0 && getPixel(image, xCoordinate, yCoordinate) != newColor && getPixel(image, xCoordinate, yCoordinate) != boundaryColor) {
putPixel(image, xCoordinate, yCoordinate, newColor);
boundaryFill(image, xCoordinate + 1, yCoordinate, newColor, boundaryColor);
boundaryFill(image, xCoordinate - 1, yCoordinate, newColor, boundaryColor);
boundaryFill(image, xCoordinate, yCoordinate + 1, newColor, boundaryColor);
boundaryFill(image, xCoordinate, yCoordinate - 1, newColor, boundaryColor);
boundaryFill(image, xCoordinate + 1, yCoordinate - 1, newColor, boundaryColor);
boundaryFill(image, xCoordinate - 1, yCoordinate + 1, newColor, boundaryColor);
boundaryFill(image, xCoordinate + 1, yCoordinate + 1, newColor, boundaryColor);
boundaryFill(image, xCoordinate - 1, yCoordinate - 1, newColor, boundaryColor);
}
}