📄 scoredata.java
字号:
/* * SchoolEJB - CyberDemia's library of EJBs for educational related services. * Copyright (C) 2003 CyberDemia Research and Services * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * See the COPYING file located in the top-level-directory of * the archive of this library for complete text of license. */package com.cyberdemia.school;import java.util.Date;import java.io.Serializable;/** * ScoreData is a data transfer object to transfer a user's test Score data to clients. * * @author Alexander Yap */public class ScoreData implements Serializable, Comparable{ public ScoreData(Integer userId, Integer testId, String testName, int score, int maxScore, boolean passed, boolean exceededTestTime, boolean taken, boolean completed, Date lastModified) { m_userId = userId; m_testId = testId; m_testName = testName; m_score = score; m_maxScore = maxScore; m_passed = passed; m_exceededTestTime = exceededTestTime; m_lastModified = lastModified; m_taken = taken; m_completed = completed; } /** * Gets the user's score. * @return User's score. */ public int getScore() { return m_score; } /** * Gets the maximum score possible if the user had answered all questions correctly. * @return Maximum score possible. */ public int getMaxScore() { return m_maxScore; } /** * Checks if the user has already taken the test. * @return true if the user has already taken the test, false otherwise. */ public boolean isTestTaken() { return m_taken; } /** * Gets user ID. * @return User ID. */ public Integer getUserId() { return m_userId; } /** * Gets test ID. * @return Test ID. */ public Integer getTestId() { return m_testId; } /** * Gets test name. * @return Test name. */ public String getTestName() { return m_testName; } /** * Gets timestamp when the user took the test. * @return Timestamp when the user took the test. */ public Date getLastModified() { return m_lastModified; } /** * Checks if the user has passed the test. * @return true if the user has passed, false if the user has failed. */ public boolean isPassed() { return m_passed; } /** * Checks if the user has exceeded the test time. * @return true if the user has exceeded the test time, false if the user completed the test within time. */ public boolean isExceededTestTime() { return m_exceededTestTime; } /** * Checks whether this user has already completed this test. * If this returns false, it may mean that either the user has never taken this test or * if the test was taken but terminated before completion (e.g. a system error). * * @ejb.interface-method * * @return true if this user has completed this test, otherwise false. */ public boolean isCompleted() { return m_completed; } /** * Compares this ScoreData with another to implement sorting based * on the lastModified field. */ public int compareTo(Object rhs) { if (rhs instanceof ScoreData) { return m_lastModified.compareTo( ((ScoreData)rhs).getLastModified()); } return -1; } private Integer m_userId = null; private Integer m_testId = null; private String m_testName = null; private int m_score = 0; private int m_maxScore = 0; private Date m_lastModified = null; private boolean m_passed = false; private boolean m_exceededTestTime = false; private boolean m_taken = false; private boolean m_completed = false;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -