01: /**********************************************************************************
02: *
03: * $Id: GradingEvents.java 9271 2006-05-10 21:52:49Z ray@media.berkeley.edu $
04: *
05: ***********************************************************************************
06: *
07: * Copyright (c) 2005 The Regents of the University of California, The MIT Corporation
08: *
09: * Licensed under the Educational Community License, Version 1.0 (the "License");
10: * you may not use this file except in compliance with the License.
11: * You may obtain a copy of the License at
12: *
13: * http://www.opensource.org/licenses/ecl1.php
14: *
15: * Unless required by applicable law or agreed to in writing, software
16: * distributed under the License is distributed on an "AS IS" BASIS,
17: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18: * See the License for the specific language governing permissions and
19: * limitations under the License.
20: *
21: **********************************************************************************/package org.sakaiproject.tool.gradebook;
22:
23: import java.io.Serializable;
24: import java.util.ArrayList;
25: import java.util.HashMap;
26: import java.util.List;
27: import java.util.Map;
28:
29: /**
30: * Represents the grading events for a group of students in a particular gradebook
31: *
32: * @author <a href="mailto:jholtzman@berkeley.edu">Josh Holtzman</a>
33: */
34: public class GradingEvents implements Serializable {
35: protected Map studentsToEventsMap;
36:
37: public GradingEvents() {
38: studentsToEventsMap = new HashMap();
39: }
40:
41: /**
42: * Returns a list of grading events, which may be empty if none exist.
43: *
44: * @param studentId
45: * @return
46: */
47: public List getEvents(String studentId) {
48: List gradingEvents = (List) studentsToEventsMap.get(studentId);
49: if (gradingEvents == null) {
50: return new ArrayList();
51: } else {
52: return gradingEvents;
53: }
54: }
55:
56: public void addEvent(GradingEvent event) {
57: String studentId = event.getStudentId();
58: List list = (List) studentsToEventsMap.get(studentId);
59: if (list == null) {
60: list = new ArrayList();
61: studentsToEventsMap.put(studentId, list);
62: }
63: list.add(event);
64: }
65:
66: }
|