Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit 295e743

Browse files
authored
style: enable MethodName in CheckStyle (TheAlgorithms#5182)
enabled: MethodName in CheckStyle
1 parent ea4dc15 commit 295e743

File tree

53 files changed

+225
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+225
-225
lines changed

checkstyle.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<module name="LocalFinalVariableName"/>
113113
<!-- TODO <module name="LocalVariableName"/> -->
114114
<!-- TODO <module name="MemberName"/> -->
115-
<!-- TODO <module name="MethodName"/> -->
115+
<module name="MethodName"/>
116116
<module name="PackageName"/>
117117
<!-- TODO <module name="ParameterName"/> -->
118118
<module name="StaticVariableName"/>

src/main/java/com/thealgorithms/backtracking/PowerSum.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ public class PowerSum {
1212
private int sum = 0;
1313

1414
public int powSum(int N, int X) {
15-
Sum(N, X, 1);
15+
sum(N, X, 1);
1616
return count;
1717
}
1818

1919
// here i is the natural number which will be raised by X and added in sum.
20-
public void Sum(int N, int X, int i) {
20+
public void sum(int N, int X, int i) {
2121
// if sum is equal to N that is one of our answer and count is increased.
2222
if (sum == N) {
2323
count++;
@@ -26,15 +26,15 @@ public void Sum(int N, int X, int i) {
2626
// result is less than N.
2727
else if (sum + power(i, X) <= N) {
2828
sum += power(i, X);
29-
Sum(N, X, i + 1);
29+
sum(N, X, i + 1);
3030
// backtracking and removing the number added last since no possible combination is
3131
// there with it.
3232
sum -= power(i, X);
3333
}
3434
if (power(i, X) < N) {
3535
// calling the sum function with next natural number after backtracking if when it is
3636
// raised to X is still less than X.
37-
Sum(N, X, i + 1);
37+
sum(N, X, i + 1);
3838
}
3939
}
4040

src/main/java/com/thealgorithms/ciphers/DES.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private String[] getSubkeys(String originalKey) {
106106
return subKeys;
107107
}
108108

109-
private String XOR(String a, String b) {
109+
private String xOR(String a, String b) {
110110
int i;
111111
int l = a.length();
112112
StringBuilder xor = new StringBuilder();
@@ -143,7 +143,7 @@ private String feistel(String messageBlock, String key) {
143143
for (i = 0; i < 48; i++) {
144144
expandedKey.append(messageBlock.charAt(EXPANSION[i] - 1));
145145
}
146-
String mixedKey = XOR(expandedKey.toString(), key);
146+
String mixedKey = xOR(expandedKey.toString(), key);
147147
StringBuilder substitutedString = new StringBuilder();
148148

149149
// Let us now use the s-boxes to transform each 6 bit (length here) block to 4 bits
@@ -175,7 +175,7 @@ private String encryptBlock(String message, String[] keys) {
175175
// Iterate 16 times
176176
for (i = 0; i < 16; i++) {
177177
String Ln = R0; // Previous Right block
178-
String Rn = XOR(L0, feistel(R0, keys[i]));
178+
String Rn = xOR(L0, feistel(R0, keys[i]));
179179
L0 = Ln;
180180
R0 = Rn;
181181
}

src/main/java/com/thealgorithms/datastructures/heaps/LeftistHeap.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void insert(int a) {
9191
}
9292

9393
// Returns and removes the minimum element in the heap
94-
public int extract_min() {
94+
public int extractMin() {
9595
// If is empty return -1
9696
if (isEmpty()) return -1;
9797

@@ -101,17 +101,17 @@ public int extract_min() {
101101
}
102102

103103
// Function returning a list of an in order traversal of the data structure
104-
public ArrayList<Integer> in_order() {
104+
public ArrayList<Integer> inOrder() {
105105
ArrayList<Integer> lst = new ArrayList<>();
106-
in_order_aux(root, lst);
106+
inOrderAux(root, lst);
107107
return new ArrayList<>(lst);
108108
}
109109

110110
// Auxiliary function for in_order
111-
private void in_order_aux(Node n, ArrayList<Integer> lst) {
111+
private void inOrderAux(Node n, ArrayList<Integer> lst) {
112112
if (n == null) return;
113-
in_order_aux(n.left, lst);
113+
inOrderAux(n.left, lst);
114114
lst.add(n.element);
115-
in_order_aux(n.right, lst);
115+
inOrderAux(n.right, lst);
116116
}
117117
}

src/main/java/com/thealgorithms/datastructures/trees/GenericTree.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ private static final class Node {
2525
private final Node root;
2626
public GenericTree() { // Constructor
2727
Scanner scn = new Scanner(System.in);
28-
root = create_treeG(null, 0, scn);
28+
root = createTreeG(null, 0, scn);
2929
}
3030

31-
private Node create_treeG(Node node, int childIndex, Scanner scanner) {
31+
private Node createTreeG(Node node, int childIndex, Scanner scanner) {
3232
// display
3333
if (node == null) {
3434
System.out.println("Enter root's data");
@@ -41,7 +41,7 @@ private Node create_treeG(Node node, int childIndex, Scanner scanner) {
4141
System.out.println("number of children");
4242
int number = scanner.nextInt();
4343
for (int i = 0; i < number; i++) {
44-
Node child = create_treeG(node, i, scanner);
44+
Node child = createTreeG(node, i, scanner);
4545
node.child.add(child);
4646
}
4747
return node;
@@ -51,17 +51,17 @@ private Node create_treeG(Node node, int childIndex, Scanner scanner) {
5151
* Function to display the generic tree
5252
*/
5353
public void display() { // Helper function
54-
display_1(root);
54+
display1(root);
5555
}
5656

57-
private void display_1(Node parent) {
57+
private void display1(Node parent) {
5858
System.out.print(parent.data + "=>");
5959
for (int i = 0; i < parent.child.size(); i++) {
6060
System.out.print(parent.child.get(i).data + " ");
6161
}
6262
System.out.println(".");
6363
for (int i = 0; i < parent.child.size(); i++) {
64-
display_1(parent.child.get(i));
64+
display1(parent.child.get(i));
6565
}
6666
}
6767

src/main/java/com/thealgorithms/datastructures/trees/nearestRightKey.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ private NearestRightKey() {
88
}
99

1010
public static void main(String[] args) {
11-
NRKTree root = BuildTree();
11+
NRKTree root = buildTree();
1212
Scanner sc = new Scanner(System.in);
1313
System.out.print("Enter first number: ");
1414
int inputX0 = sc.nextInt();
@@ -17,7 +17,7 @@ public static void main(String[] args) {
1717
sc.close();
1818
}
1919

20-
public static NRKTree BuildTree() {
20+
public static NRKTree buildTree() {
2121
int randomX = ThreadLocalRandom.current().nextInt(0, 100 + 1);
2222
NRKTree root = new NRKTree(null, null, randomX);
2323

src/main/java/com/thealgorithms/dynamicprogramming/KadaneAlgorithm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public final class KadaneAlgorithm {
1010
private KadaneAlgorithm() {
1111
}
1212

13-
public static boolean max_Sum(int[] a, int predicted_answer) {
13+
public static boolean maxSum(int[] a, int predicted_answer) {
1414
int sum = a[0];
1515
int running_sum = 0;
1616
for (int k : a) {

src/main/java/com/thealgorithms/dynamicprogramming/LongestAlternatingSubsequence.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ private LongestAlternatingSubsequence() {
1616
}
1717

1818
/* Function to return longest alternating subsequence length*/
19-
static int AlternatingLength(int[] arr, int n) {
19+
static int alternatingLength(int[] arr, int n) {
2020
/*
2121
2222
las[i][0] = Length of the longest
@@ -68,6 +68,6 @@ public static void main(String[] args) {
6868
int[] arr = {10, 22, 9, 33, 49, 50, 31, 60};
6969
int n = arr.length;
7070
System.out.println("Length of Longest "
71-
+ "alternating subsequence is " + AlternatingLength(arr, n));
71+
+ "alternating subsequence is " + alternatingLength(arr, n));
7272
}
7373
}

src/main/java/com/thealgorithms/dynamicprogramming/LongestIncreasingSubsequence.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ private static int upperBound(int[] ar, int l, int r, int key) {
2020
return r;
2121
}
2222

23-
public static int LIS(int[] array) {
23+
public static int lis(int[] array) {
2424
int N = array.length;
2525
if (N == 0) {
2626
return 0;

src/main/java/com/thealgorithms/dynamicprogramming/LongestPalindromicSubsequence.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ public static void main(String[] args) {
1212
String a = "BBABCBCAB";
1313
String b = "BABCBAB";
1414

15-
String aLPS = LPS(a);
16-
String bLPS = LPS(b);
15+
String aLPS = lps(a);
16+
String bLPS = lps(b);
1717

1818
System.out.println(a + " => " + aLPS);
1919
System.out.println(b + " => " + bLPS);
2020
}
2121

22-
public static String LPS(String original) throws IllegalArgumentException {
22+
public static String lps(String original) throws IllegalArgumentException {
2323
StringBuilder reverse = new StringBuilder(original);
2424
reverse = reverse.reverse();
2525
return recursiveLPS(original, reverse.toString());

0 commit comments

Comments
 (0)