clickermatic client component-level design. client class diagram...
TRANSCRIPT
Client Class Diagram
Controller
Timer
UserInterface
Question
DefaultProtocol
Client
ConnectionManager
NetworkInterface
QuestionRecordHistorian
TimerListener <<Interface>>
Protocol<<Interface>>
0..n1
Historian
- NUMBER_OF_QUESTIONS_TO_TRACK: constant int- numberOfQuestionsAnsweredCorrectly: int- numberOfQuestionsAnsweredIncorrectly: int- records: list<QuestionRecord>
+ resetTallies(): void+ addQuestionAnswerRecord(questionNumber: int, clientAnswer:
string, answerIsCorrect: boolean, timeTakenToAnswerQuestion: int, correctAnswer: string): void
QuestionRecord
- questionNumber: int- clientAnswer: string- answerIsCorrect: boolean- timeTakenToAnswerQuestion: int-serverAnswer: string-questionText: string
ConnectionManager
- networkInterface: NetworkInterface- protocol: Protocol- serverIPAddress: string- serverPortNumber: int
+ logIn(name: string): void+ sendQuestionToUser(questionNumber: int, questionType: int,
timeLimit: int, tallyModeForced: boolean, questionText: string; answerOptions: list<string>): void
+ submitUserAnswerToServer(questionNumber: int, answeredInTimeLimit: boolean, elapsedTime: int, clientAnswer: string): void
+ submitServerAnswerToUser(clientAnswer: string, correctAnswer: string, answerIsCorrect: boolean, timeTaken: int): void
+ informUserOfEndOfQuestionSet(): void+ sendDisconnectionRequestToServer(): void+ decodeNetworkBytes(bytes: byte[]): void+ isOpen(): boolean
NetworkInterface
Attributes are implementation-dependent.
+ openConnection(userName: String, address: string, portNumber: int): void
+ sendBytesToServer(bytesToSend: byte[]): void+ connectionIsOpen(): boolean
<<interface>>
Protocol
+ decodeNetworkBytes(bytes: byte[])+ createAnswerChoiceSubmission(questionNumber: int,
answerChoice: string)+ createConnectionEndRequest(): byte[]+ getConnectionManager(): ConnectionManager+ setConnectionManager(cm: ConnectionManager): void
DefaultProtocol
- connectionManager: ConnectionManager
+ decodeNetworkBytes(bytes: byte[])+ createAnswerChoiceSubmission(questionNumber: int,
answeredInTimeLimit: boolean, elapsedTime: int, clientAnswer: string): byte[]
+ createConnectionEndRequest(): byte[]
Timer
- time: int- running: boolean- timerListeners: set<TimerListener>
+ expired(): boolean+ addTimerListener(newListener: TimerListener): void+ updateTime(): void+ updateTimerListeners(): void+ reset()
Controller
- historian: Historian- currentQuestion: Question- connectionManager: ConnectionManager- timer: Timer- inTallyMode: boolean
+ logIn(name: string): void+ sendQuestionToUser(questionNumber: int, questionType: int, timeLimit: int,
tallyModeForced: boolean, questionText: string; answerOptions: list<string>): void
+ submitUserAnswerToServer(questionNumber: int, answeredInTimeLimit: boolean, elapsedTime: int, clientAnswer: string): void
+ sendTimeExpiredNotificationToServer(): void+ submitServerAnswerToUser(clientAnswer: string, correctAnswer: string,
answerIsCorrect: boolean, timeTaken: int): void+ informUserOfEndOfQuestionSet(): void+ sendDisconnectionRequestToServer(): void+ timerTimeChanged(time: int): void+ timerExpired(): void
Server Class Diagram
0..500
Controller
Timer
UserInterface
QuestionSet
Question
ConnectedUser
Protocol
Server
ConnectionHandler1
QuestionHandler
0..n
1
ResultHandler ResultSet QuestionResult0..n
1
UserQuestionResult
0..500
1
UserInterface
- controller: Controller - tallyMode: Boolean- questionStatistics: Boolean- jumpQuestionNum: Int
- startUp()- getInstanceOf()- displayStartupScreen()- exit()- beginQuestions()- displayNextQuestion()- displayQuestionStats(Question)- displayQuestionSetStats(QuestionSet)- update()
Controller
- connectionHandler: ConnectionHandler- resultHandler: ResultHandler- questionHandler: QuestionHandler
ConnectionHandler
- protocol: Protocol- connectedUsers[]: ConnectedUser
- listenForClients()- openConnection(IPAddress: string, userName: string, socket: Socket)- sendQuestion()- sendGradedQuestion()- sendEndOfSet()- sendGoodbye()- sendPacket(packet: Packet)- decodePacket(packet: Packet)- closeConnection(connectedUserIndex: int)
Protocol
- userQuestionResult : UserQuestionResult
- createQuestionPacket(question: Question): Packet- createGradedQuestionPacket(question: Question): Packet- createEndOfSetPacket(): Packet- createGoodbyePacket(): Packet- decodePacket(packet Packet)- storeResult(Packet)
ResultHandler
- resultSet: ResultSet
- exportStatisticsFile(fileName: string, IPAddress: string, questionIndex: int)
ResultSet
- questionResults[]: QuestionResult- averageCorrectAnswers: int- precentageOfCorrectAnswer: int
- calculateSetResults()
QuestionResult
- userQuestionResults[]: UserQuestionResult- questionType: int- answers[]: string- countOfEachAnswer[]: int- correctAnswerIndex[]: int- mostCommonWrongAnswerIndex: int- minAnswer: int- maxAnswer: int- averageAnswer: int
- calculateQuestionResults()- calculateNumberResults()
UserQuestionResult
- userName: string- userIPAddress: string- submittedAnswer: string- timeToAnswer: int
QuestionHandler
- timer: Timer- questionSet: QuestionSet- currentQuestion:
- loadSet(fileName: string)- nextQuestion()- gotoQuestion()- repeatPreviousQuestion()