mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-27 06:23:08 +08:00
style: enable MethodName
in CheckStyle (#5182)
enabled: MethodName in CheckStyle
This commit is contained in:

committed by
GitHub

parent
ea4dc15a24
commit
295e7436b1
@ -33,7 +33,7 @@ public final class KochSnowflake {
|
||||
ArrayList<Vector2> vectors = new ArrayList<Vector2>();
|
||||
vectors.add(new Vector2(0, 0));
|
||||
vectors.add(new Vector2(1, 0));
|
||||
ArrayList<Vector2> result = Iterate(vectors, 1);
|
||||
ArrayList<Vector2> result = iterate(vectors, 1);
|
||||
|
||||
assert result.get(0).x == 0;
|
||||
assert result.get(0).y == 0;
|
||||
@ -54,7 +54,7 @@ public final class KochSnowflake {
|
||||
int imageWidth = 600;
|
||||
double offsetX = imageWidth / 10.;
|
||||
double offsetY = imageWidth / 3.7;
|
||||
BufferedImage image = GetKochSnowflake(imageWidth, 5);
|
||||
BufferedImage image = getKochSnowflake(imageWidth, 5);
|
||||
|
||||
// The background should be white
|
||||
assert image.getRGB(0, 0) == new Color(255, 255, 255).getRGB();
|
||||
@ -80,10 +80,10 @@ public final class KochSnowflake {
|
||||
* @param steps The number of iterations.
|
||||
* @return The transformed vectors after the iteration-steps.
|
||||
*/
|
||||
public static ArrayList<Vector2> Iterate(ArrayList<Vector2> initialVectors, int steps) {
|
||||
public static ArrayList<Vector2> iterate(ArrayList<Vector2> initialVectors, int steps) {
|
||||
ArrayList<Vector2> vectors = initialVectors;
|
||||
for (int i = 0; i < steps; i++) {
|
||||
vectors = IterationStep(vectors);
|
||||
vectors = iterationStep(vectors);
|
||||
}
|
||||
|
||||
return vectors;
|
||||
@ -96,7 +96,7 @@ public final class KochSnowflake {
|
||||
* @param steps The number of iterations.
|
||||
* @return The image of the rendered Koch snowflake.
|
||||
*/
|
||||
public static BufferedImage GetKochSnowflake(int imageWidth, int steps) {
|
||||
public static BufferedImage getKochSnowflake(int imageWidth, int steps) {
|
||||
if (imageWidth <= 0) {
|
||||
throw new IllegalArgumentException("imageWidth should be greater than zero");
|
||||
}
|
||||
@ -111,8 +111,8 @@ public final class KochSnowflake {
|
||||
initialVectors.add(vector2);
|
||||
initialVectors.add(vector3);
|
||||
initialVectors.add(vector1);
|
||||
ArrayList<Vector2> vectors = Iterate(initialVectors, steps);
|
||||
return GetImage(vectors, imageWidth, imageWidth);
|
||||
ArrayList<Vector2> vectors = iterate(initialVectors, steps);
|
||||
return getImage(vectors, imageWidth, imageWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,7 +125,7 @@ public final class KochSnowflake {
|
||||
* applied.
|
||||
* @return The transformed vectors after the iteration-step.
|
||||
*/
|
||||
private static ArrayList<Vector2> IterationStep(ArrayList<Vector2> vectors) {
|
||||
private static ArrayList<Vector2> iterationStep(ArrayList<Vector2> vectors) {
|
||||
ArrayList<Vector2> newVectors = new ArrayList<Vector2>();
|
||||
for (int i = 0; i < vectors.size() - 1; i++) {
|
||||
Vector2 startVector = vectors.get(i);
|
||||
@ -149,7 +149,7 @@ public final class KochSnowflake {
|
||||
* @param imageHeight The height of the rendered image.
|
||||
* @return The image of the rendered edges.
|
||||
*/
|
||||
private static BufferedImage GetImage(ArrayList<Vector2> vectors, int imageWidth, int imageHeight) {
|
||||
private static BufferedImage getImage(ArrayList<Vector2> vectors, int imageWidth, int imageHeight) {
|
||||
BufferedImage image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
|
||||
Graphics2D g2d = image.createGraphics();
|
||||
|
||||
|
Reference in New Issue
Block a user