Skip to content

Class Diagram

Süleyman Emir Taşan edited this page Dec 19, 2024 · 7 revisions
classDiagram
    class User {
        -int id
        -String username
        -String name
        -String email
        -String password
        -String proficiencyLevel
        -int eloPoints
        -String profile_picture
        -List~Quiz~ createdQuizzes
        -List~QuizAttempt~ solvedQuizzes
        -List~Question~ favoritedQuestions
        -List~Quiz~ favoritedQuizzes
        -List~ForumPost~ forumPosts
        +createAccount(username :String, email :String, password :String)
        +login(username :String, password:String)
        +createQuiz(title :String, description: String, questions :List~Question~)
        +createQuizFromFavorites(title :String, description: String, count: int)
        +favoriteQuiz(quiz :Quiz)
        +favoriteQuestion(question :Question)
        +createForumPost(content :String)
        +replyForumPost(postToReply :ForumPost, content :String)
        +getRecommendedQuizzes(userElo: Integer) List~Quiz~
        +followUser(User user)
        +unfollowUser(User user)
        +getFollowers() List~User~
        +getFollowing() List~User~

        +getId() int
        +getUsername() String
        +setUsername(username : String)
        +getName() String
        +setName(name : String)
        +getEmail() String
        +setEmail(email : String)
        +getPassword() String
        +setPassword(password : String)
        +getProficiencyLevel() String
        +setProficiencyLevel(proficiencyLevel : String)
        +getPoints() int
        +setPoints(points : int)
        +getProfilePicture() String
        +setProfilePicture(profile_picture : String)
        +getCreatedQuizzes() List~Quiz~
        +getSolvedQuizzes() List~QuizAttempt~
        +getFavoritedQuestions() List~Question~
        +getFavoritedQuizzes() List~Quiz~
        +getForumPosts() List~ForumPost~
    }

    class Quiz {
        -int id
        -String title
        -String description
        -String image
        -User creator
        -int difficulty
        -List~Question~ questions

        +Quiz(title : String, description : String, image: String, creator: User)
        +addQuestion(question: Question)
        +calculateDifficulty() int
        +getAverageScore() double
        +getSuccessRateByQuestion() Map~Question, Double~
        +getMostMissedQuestions() List~Question~

        +getId() int
        +getTitle() String
        +setTitle(title : String)
        +getDescription() String
        +setDescription(description : String)
        +getImage() String
        +setImage(image : String)
        +getCreator() User
        +setCreator(creator : User)
        +getDifficulty() int
        +setDifficulty(difficulty : int)
        +getQuestions() List~Question~
        +setQuestions(questions : List~Question~)
    }

    class QuizAttempt{
        -int id
        -Quiz quiz
        -User user
        -List~QuestionAnswer~ questionAnswers
        -int score
        -Timestamp completed_at

        +QuizAttempt(quiz : Quiz, user : User)
        +submitAnswer(Question question, String answer)

        +getId() int
        +getQuiz() Quiz
        +setQuiz(quiz : Quiz)
        +getUser() User
        +setUser(user : User)
        +getQuestionAnswers() List~QuestionAnswer~
        +setQuestionAnswers(questionAnswers : List~QuestionAnswer~)
        +getScore() int
        +setScore(score : int)
        +getCompletedAt() Timestamp
        +setCompletedAt(completed_at : Timestamp)
    }

    class Question {
        -int id
        -String questionType
        -String questionText
        -String correctAnswer
        -List~String~ wrongAnswers

        +Question(questionType : String, questionText: String, correctAnswer: String, wrongAnswers: List~String~)
        +getDifficulty() int
        +getAllHints(word: String) List~String~

        +getId() int
        +getQuestionType() String
        +setQuestionType(questionType : String)
        +getQuestionText() String
        +setQuestionText(questionText : String)
        +getCorrectAnswer() String
        +setCorrectAnswer(correctAnswer : String)
        +getWrongAnswers() List~String~
        +setWrongAnswers(wrongAnswers : List~String~)
    }

    class QuestionAnswer {
        -int id
        -Question question
        -String answer
        -bool correct

        +QuestionAnswer(question : Question, answer: String)

        +getId() int
        +getQuestion() Question
        +setQuestion(question : Question)
        +getAnswer() String
        +setAnswer(answer : String)
        +isCorrect() bool
        +setCorrect(correct : bool)
    }

    class ForumPost {
        -int id
        -User author
        -String content
        -List~Reply~ replies
        -int voteCount

        +ForumPost(author :User, content :String)
        +addReply(reply : Reply)
        +editPost(String newContent)
        +deletePost()
        +upvote()
        +downvote()


        +getID() int
        +getAuthor() String
        +setAuthor(author : String)
        +getContent() String
        +setContent(content : String)
        +getReplies() List~Reply~
        +getVoteCount() int
    }

    class Reply {
        -int id
        -String content
        -User author
        -int voteCount

        +Reply(author :User, content: String)
        +upvote()
        +downvote()

        +getId() int
        +getContent() String
        +setContent(content : String)
        +getAuthor() String
        +setAuthor(author : String)
        +getVoteCount() int
    }

    class WikiDataInfo {
        -int id
        -List~String~ entityIds
        -String word

        +WikiDataInfo(word: String)
        +findEntities(word: String) List~String~
        +generateHint(entityIds: String) List~String~
        
        +getWord() String
        +setWord(word: String)
    }

    User "1" o-- "*" Quiz : creates
    User "*" --> "*" Question : favorites
    User "*" --> "*" Quiz : favorites
    Quiz "1" *-- "*" Question : contains
    User "1" *-- "*" ForumPost : creates
    ForumPost "1" *-- "*" Reply : has replies
    Quiz "1" --o "*" QuizAttempt
    User "1" *-- "*" QuizAttempt : attempts
    QuizAttempt "*" *-- "*" QuestionAnswer
    Question "1" --o "*" QuestionAnswer
    User <--> Reply
    Question "1" --> "*" WikiDataInfo


Loading

🏠 Home

🗃️ All Project Files

💻 Lab Reports

📝 Meeting Notes

Lab Meeting Notes
Team Meeting Notes
🧑🏻‍💻 About Us
🗂️ Templates
CmpE 352

🚀 Important Project Files

🗃️ All Project Files
📝 352 Meeting Notes
📜 Research & Resources
Clone this wiki locally