From a78cbb3a67ae1599d049e4939cf6711e81bb5360 Mon Sep 17 00:00:00 2001 From: Artem Darius Weber Date: Thu, 2 Jan 2025 15:47:02 +0300 Subject: [PATCH] refactor: update class method signatures and improve initialization in Person and Student classes --- lab2/README.md | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lab2/README.md b/lab2/README.md index 9d7c6cc..f67209e 100644 --- a/lab2/README.md +++ b/lab2/README.md @@ -40,29 +40,28 @@ classDiagram - id : String - git : String - contact : Contact - + Person(id : String, git : String, contact : Contact) + + Person(id : String, git : String, contact : Contact = new Contact()) + git_present() : Boolean + contact_present() : Boolean + contact_info() : String - + git=(String) : Boolean - - validate_id(id: String) : Boolean - - validate_git(id: String) : Boolean - - - valid_git(git : String) : Boolean - - valid_id(id : String) : Boolean + + git=(git : String) : void + - validate_id(id: String) : void + - validate_git(git : String) : void + - validate_contact(contact : Contact) : void + - valid_git?(git : String) : Boolean + - valid_id?(id : String) : Boolean } class StudentRepository { - + read_from_txt(file_path : String) : List~Student~ - + write_to_txt(file_path : String, students : List~Student~) + + self.read_from_txt(file_path : String) : List~Student~ + + self.write_to_txt(file_path : String, students : List~Student~) } class StudentShort { - surname_initials : String - - contact : Contact + StudentShort(id : String, git : String, surname_initials : String, contact : Contact) - + from_student(student : Student) : StudentShort - + from_string(id : String, info_string : String) : StudentShort + + self.from_student(student : Student) : StudentShort + + self.from_string(id : String, info_string : String) : StudentShort + to_s() : String } @@ -71,12 +70,19 @@ classDiagram - name : String - patronymic : String - birth_date : Date + - const NAME_REGEX : String + Student(id : String, git : String, contact : Contact, surname : String, name : String, patronymic : String, birth_date : Date) - + from_string(student_string : String) : Student + + self.from_string(student_string : String) : Student + surname_and_initials() : String + to_s() : String + get_info() : String - - validate_student() + + surname=(surname : String) + + name=(name : String) + + patronymic=(patronymic : String) + + birth_date=(birthdate : String) + + self.valid_name?(name : String) : Boolean + - name_initial(name : String) : String + - patronymic(patronymic : String) : String } BinarySearchTree o-- Node