-
Notifications
You must be signed in to change notification settings - Fork 0
Решение задачи #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| @@ -0,0 +1,6 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Файлы из .idea не исчезли, посмотри пример в предыдущем репозитории
src/Cryptor.java
Outdated
| str = reader.readLine(); | ||
|
|
||
| } catch (Exception e) { | ||
| e.printStackTrace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исключения, которые не можешь обработать, надо пробрасывать выше
… и reader. Убрал из класса Cryptor пути. Пути принимаются в параметрах метода
…мо реализовать класс FileHandlerV2
src/CryptorV2.java
Outdated
| @@ -0,0 +1,60 @@ | |||
| public class CryptorV2 { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Очень много общего между Cryptor и CryptorV2, как можно выделить общую идею?
src/FileHandler.java
Outdated
|
|
||
| String fileIn; | ||
| String fileOut; | ||
| CryptorViaString cryptorViaString; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Этих ребят здесь не должно быть
src/TestClass.java
Outdated
|
|
||
| public class TestClass implements Crypt { | ||
|
|
||
| public TestClass(CryptorViaString cryptorViaString, CryptorViaStringBuilder cryptorViaStringBuilder){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему пустой конструктор? Ты должен обе этих переменных запомнить в поля класса
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправил
| @@ -0,0 +1,4 @@ | |||
| public interface Crypt { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crypt - глагол если я не ошибаюсь, этот интерфейс у тебя описывает сервис. Поэтому здесь должно быть существительное - Cryptor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Переименовал на Cryptor
| @@ -0,0 +1,40 @@ | |||
| import java.io.IOException; | |||
|
|
|||
| public class Cryptor implements Crypt { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это сервис и для него правильно - Cryptor. Только вот он же не просто шифровальщик а с некоторой изюминкой, надо отразить это в названии.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Переименовал на CryptorWithTimeAssessment
| CryptorViaStringBuilder cryptorViaStringBuilder; | ||
|
|
||
| public Cryptor(CryptorViaString cryptorViaString, CryptorViaStringBuilder cryptorViaStringBuilder) { | ||
| this.cryptorViaString = cryptorViaString; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не вижу чтобы ты его использовал и сравнивал время выполнения. Сейчас ты используешь только второй
| import java.nio.file.Path; | ||
|
|
||
| public class FileHandler { | ||
| Cryptor cryptor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Этому классу должно быть без разницы, с какой реализацией интерфейса работать. Здесь нужно принимать максимально абстрактную сущность
No description provided.