소스 검색

matrix: make classes and methods package private in reference solution. Resolved the issue (#1083)

* made the class as the package private and the removed the public access modifier

* made the class as the package private and the removed the public access modifier

* removing the extra spaces

* removed the access modifier of the class Hamming and also the methods involving it

* added the private access modifier for the methods in Hamming class
PratikPalashikar 8 년 전
부모
커밋
3093dd8d24
1개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 6
    6
      exercises/matrix/.meta/src/reference/java/Matrix.java

+ 6
- 6
exercises/matrix/.meta/src/reference/java/Matrix.java 파일 보기

1
 import java.util.regex.Pattern;
1
 import java.util.regex.Pattern;
2
 
2
 
3
-public class Matrix {
3
+class Matrix {
4
     private int[][] matrix;
4
     private int[][] matrix;
5
     private static Pattern spacePattern = Pattern.compile(" ");
5
     private static Pattern spacePattern = Pattern.compile(" ");
6
     private static Pattern newlinePattern = Pattern.compile("\\n");
6
     private static Pattern newlinePattern = Pattern.compile("\\n");
7
 
7
 
8
-    public Matrix(String matrixAsString) {
8
+     Matrix(String matrixAsString) {
9
         String[] rows = newlinePattern.split(matrixAsString);
9
         String[] rows = newlinePattern.split(matrixAsString);
10
         matrix = new int[rows.length][];
10
         matrix = new int[rows.length][];
11
         for (int i = 0; i < rows.length; i++) {
11
         for (int i = 0; i < rows.length; i++) {
17
         }
17
         }
18
     }
18
     }
19
 
19
 
20
-    public int[] getRow(int rowNumber) {
20
+    int[] getRow(int rowNumber) {
21
         return matrix[rowNumber];
21
         return matrix[rowNumber];
22
     }
22
     }
23
 
23
 
24
-    public int[] getColumn(int columnNumber) {
24
+    int[] getColumn(int columnNumber) {
25
         int[] column = new int[matrix.length];
25
         int[] column = new int[matrix.length];
26
         for(int i = 0; i < matrix.length; i++) {
26
         for(int i = 0; i < matrix.length; i++) {
27
             column[i] = matrix[i][columnNumber];
27
             column[i] = matrix[i][columnNumber];
29
         return column;
29
         return column;
30
     }
30
     }
31
 
31
 
32
-    public int getRowsCount() {
32
+    int getRowsCount() {
33
         return matrix.length;
33
         return matrix.length;
34
     }
34
     }
35
 
35
 
36
-    public int getColumnsCount() {
36
+    int getColumnsCount() {
37
         return matrix[0].length;
37
         return matrix[0].length;
38
     }
38
     }
39
 }
39
 }