Просмотр исходного кода

Merge pull request #1039 from bmkiefer/crypto-square-ref-solution

crypto-square: make classes and methods package private in reference solution
Sam Warner 8 лет назад
Родитель
Сommit
40d9e450f8
Аккаунт пользователя с таким Email не найден
1 измененных файлов: 7 добавлений и 7 удалений
  1. 7
    7
      exercises/crypto-square/.meta/src/reference/java/Crypto.java

+ 7
- 7
exercises/crypto-square/.meta/src/reference/java/Crypto.java Просмотреть файл

1
 import java.util.ArrayList;
1
 import java.util.ArrayList;
2
 import java.util.List;
2
 import java.util.List;
3
 
3
 
4
-public class Crypto {
4
+class Crypto {
5
 
5
 
6
     private String normalizedPlaintext;
6
     private String normalizedPlaintext;
7
     private int squareSize;
7
     private int squareSize;
8
 
8
 
9
-    public Crypto(String text) {
9
+    Crypto(String text) {
10
         this.normalizedPlaintext = normalizeText(text);
10
         this.normalizedPlaintext = normalizeText(text);
11
         this.squareSize = calculateSquareSize(normalizedPlaintext);
11
         this.squareSize = calculateSquareSize(normalizedPlaintext);
12
     }
12
     }
13
 
13
 
14
-    public String getNormalizedPlaintext() {
14
+    String getNormalizedPlaintext() {
15
         return normalizedPlaintext;
15
         return normalizedPlaintext;
16
     }
16
     }
17
 
17
 
18
-    public int getSquareSize() {
18
+    int getSquareSize() {
19
         return squareSize;
19
         return squareSize;
20
     }
20
     }
21
 
21
 
30
         return (int) Math.ceil(Math.sqrt(text.length()));
30
         return (int) Math.ceil(Math.sqrt(text.length()));
31
     }
31
     }
32
 
32
 
33
-    public List<String> getPlaintextSegments() {
33
+    List<String> getPlaintextSegments() {
34
         return getSegmentText(normalizedPlaintext, squareSize);
34
         return getSegmentText(normalizedPlaintext, squareSize);
35
     }
35
     }
36
 
36
 
50
         return segments;
50
         return segments;
51
     }
51
     }
52
 
52
 
53
-    public String getCipherText() {
53
+    String getCipherText() {
54
         return getNormalizedCipherText().replaceAll("\\s", "");
54
         return getNormalizedCipherText().replaceAll("\\s", "");
55
     }
55
     }
56
 
56
 
57
-    public String getNormalizedCipherText() {
57
+    String getNormalizedCipherText() {
58
         StringBuilder cipherText = new StringBuilder(normalizedPlaintext.length());
58
         StringBuilder cipherText = new StringBuilder(normalizedPlaintext.length());
59
 
59
 
60
         for (int index = 0; index < squareSize; index++) {
60
         for (int index = 0; index < squareSize; index++) {