Skip to content

Commit 0f0a25e

Browse files
committed
refactor: remove Cypher
1 parent 4ab419a commit 0f0a25e

2 files changed

Lines changed: 8 additions & 25 deletions

File tree

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
package io.github.vbetsch.codecracker;
22

33
public class CodeCracker {
4-
private final Cypher cypher = new Cypher();
4+
private final TranslationDictionary dictionary = new TranslationDictionary();
55

66
public char decryptLetter(char letter) {
7-
return cypher.decryptLetter(letter);
7+
return dictionary.getDecryptions().get(letter);
88
}
99

1010
public char encryptChar(char character) {
11-
return cypher.encryptChar(character);
11+
return dictionary.getEncryptions().get(character);
1212
}
1313

1414
public String decryptWord(String string) {
15-
return cypher.decryptWord(string);
15+
StringBuilder stringBuilder = new StringBuilder();
16+
for (char c : string.toCharArray()) {
17+
stringBuilder.append(decryptLetter(c));
18+
}
19+
return stringBuilder.toString();
1620
}
1721
}

src/main/java/io/github/vbetsch/codecracker/Cypher.java

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)