You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kubsu-sm5-ruby/lab2
Artem-Darius Weber 82a2b663a8
refactor: clean up comments in student list classes for clarity and consistency
2 months ago
..
db/migrations feat: implement database-backed student management with MySQL and add persistence strategies 2 months ago
providers refactor: clean up comments in student list classes for clarity and consistency 2 months ago
tests refactor: clean up comments in student list classes for clarity and consistency 2 months ago
README.md refactor: clean up comments in student list classes for clarity and consistency 2 months ago
binary_search_tree.rb feat: add BinarySearchTree class and integrate birth_date handling in Student class LAB 3 TASK 4 4 months ago
compose.yml feat: implement database-backed student management with MySQL and add persistence strategies 2 months ago
data_list_student_short.rb refactor: streamline item filtering in DataListStudentShort initialization 2 months ago
data_table.rb feat: enhance DataList and DataListStudentShort to support column names and improve data handling 2 months ago
db_connection.rb feat: implement database-backed student management with MySQL and add persistence strategies 2 months ago
main.rb refactor: implement surname_initials method and update references for consistency 4 months ago
person.rb feat: enhance DataList and DataListStudentShort to support column names and improve data handling 2 months ago
student.rb feat: implement database-backed student management with MySQL and add persistence strategies 2 months ago
student_repository.rb refactor: update Student class initialization and validation; add StudentRepository for file operations 4 months ago
student_short.rb refactor: implement surname_initials method and update references for consistency 4 months ago

README.md

Lab 2

Диаграмма классов:

classDiagram
    class PersistenceStrategy {
        + load(filename : String) : Raise
        + save(filename : String, students : Students) : Raise
    }

    class StudentsListBase {
        + initialize(filename : String)
        + load_from_file() : Raise
        + save_to_file() : Raise
        + get_student_by_id(id : String) : Student
        + get_k_n_student_short_list(k : Int, n : Int, data_list = nil) : List<Student>
        + sort_students() : List<Student>
        + add_student(student : Student) : Student
        + update_student_by_id(id : Int, new_stodent : Student) : Bool
        + delete_student_by_id(id : Int)
        + get_student_short_count() : Int
    }

    class StudentsListDB {
        + initialize()
        + get_student_by_id(id : Int) : nil | Student
        + get_k_n_student_short_list(k : Int, n : Int) : List<Student>
        + add_student(student : Student) : Student
        + update_student_by_id(id : Int, new_student : Student)
        + delete_student_by_id(id : Int)
        + get_student_short_count() : Int
        - row_to_student(row : Student)
        - escape(value : any)
    }

    class JSONPersistenceStrategy {
        + load(filename : String) : List<>
        + save(filename : String, students : List<Student>)
        - student_to_hash(student : Student)
        - hash_to_student(hash : String)
    }

    class TXTPersistenceStrategy {
        + load(filename : String) : List<>
        + save(filename : String, students : List<Student>)
    }

    class YAMLPersistenceStrategy {
        + load(filename : String) : List<>
        + save(filename : String, students : List<Student>)
        - student_to_hash(student : Student)
        - hash_to_student(hash : String)
    }

    class StudentsList {
        + initialize(filename : String, persistence_strategy)
        + load() : self
        + save() : self
        + get_student_by_id(id : Int) : Student
        + get_k_n_student_short_list(k : Int, n : Int, data_list = nil) : DataListStudentShort
        + sort_students() : List<Student>
        add_student(student : Student) : Student
        + update_student_by_id(id : Int, new_student : Student) : Bool
        + delete_student_by_id(id : Int) : Bool
        + get_student_short_count() : Int
    }

    class DatabaseConnection {
        + initialize()
        + client()
        + query(sql : String)
    }

    class BinarySearchTree {
        - root : Node
        + add(student : Student) : void
        + each(&block) : void
        - insert(node : Node, student : Student) : Node
        - in_order_traversal(node : Node, &block) : void
    }

    class Node {
        - student : Student
        - left : Node
        - right : Node
        + Node(student : Student)
    }

    class Person {
        - id : String
        - git : String
        - phone : String?
        - telegram : String?
        - email : String?
        + Person(id : String, git : String, phone: String, telegram: String, email: String)
        + phone=(String) : Boolean
        + telegram=(String) : Boolean
        + email=(String) : Boolean
        + surname_initials() : NotImplementedError
        + valid_phone_number() : Boolean <<class>>
        + valid_telegram() : Boolean <<class>>
        + valid_email() : Boolean <<class>>
        + git_present() : Boolean
        + contact_present() : Boolean
        + get_first_contact() : String
        + git=(git : String) : void
        + validate_id(id: String) : void <<class>>
        + validate_git(git : String) : void <<class>>
        - valid_git?(git : String) : Boolean
        - valid_id?(id : String) : Boolean
    }

    class StudentRepository {
        + read_from_txt(file_path : String) : List~Student~ <<class>>
        + write_to_txt(file_path : String, students : List~Student~) <<class>>
    }

    class StudentShort {
        - surname_initials : String
        + get_surname_initials() : String
        + StudentShort(id : String, surname_initials : String, phone: String, telegram: String, email: String)
        + from_student(student : Student) : StudentShort <<class>>
        + from_string(id : String, info_string : String) : StudentShort <<class>>
        + to_s() : String
        - parse_contact_string(contact_string: String) : Array<String> <<class>>
    }

    class Student {
        - surname : String
        - name : String
        - patronymic : String
        - birth_date : Date
        - const NAME_REGEX : String
        + Student(id : String, git : String, phone: String, telegram: String, email: String, surname : String, name : String, patronymic : String, birth_date : Date)
        + from_string(student_string : String) : Student <<class>>
        + surname_initials() : String
        + to_s() : String
        + get_info() : String
        + surname=(surname : String)
        + name=(name : String)
        + patronymic=(patronymic : String)
        + birth_date=(birthdate : String)
        + valid_name?(name : String) : Boolean <<class>>
        - name_initial(name : String) : String
        - patronymic(patronymic : String) : String
    }

    BinarySearchTree o-- Node
    Node o-- Student
    StudentsList o-- Student
    StudentsListBase o-- Student
    StudentsListDB o-- DatabaseConnection
    DatabaseConnection <.. Singleton
    JSONPersistenceStrategy o-- PersistenceStrategy
    TXTPersistenceStrategy o-- PersistenceStrategy
    YAMLPersistenceStrategy o-- PersistenceStrategy
    Person <|-- Student
    Person <|-- StudentShort
    Student <.. StudentRepository