001: /**********************************************************************************
002: *
003: * $Id: GradingScale.java 21205 2007-02-09 20:00:15Z ray@media.berkeley.edu $
004: *
005: ***********************************************************************************
006: *
007: * Copyright (c) 2006 The Regents of the University of California
008: *
009: * Licensed under the Educational Community License, Version 1.0 (the "License");
010: * you may not use this file except in compliance with the License.
011: * You may obtain a copy of the License at
012: *
013: * http://www.opensource.org/licenses/ecl1.php
014: *
015: * Unless required by applicable law or agreed to in writing, software
016: * distributed under the License is distributed on an "AS IS" BASIS,
017: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018: * See the License for the specific language governing permissions and
019: * limitations under the License.
020: *
021: **********************************************************************************/package org.sakaiproject.tool.gradebook;
022:
023: import java.io.Serializable;
024: import java.util.List;
025: import java.util.Map;
026:
027: import org.apache.commons.lang.builder.ToStringBuilder;
028:
029: public class GradingScale implements Serializable, Comparable {
030: private Long id;
031: private int version;
032:
033: private String uid;
034: private String name;
035: private List<String> grades;
036: private Map<String, Double> defaultBottomPercents; // From grade to percentage
037: private boolean unavailable;
038:
039: public Map<String, Double> getDefaultBottomPercents() {
040: return defaultBottomPercents;
041: }
042:
043: public void setDefaultBottomPercents(
044: Map<String, Double> defaultBottomPercents) {
045: this .defaultBottomPercents = defaultBottomPercents;
046: }
047:
048: public String getUid() {
049: return uid;
050: }
051:
052: public void setUid(String uid) {
053: this .uid = uid;
054: }
055:
056: public String getName() {
057: return name;
058: }
059:
060: public void setName(String name) {
061: this .name = name;
062: }
063:
064: /**
065: * Because the Gradebook now supports non-calculated manual-only grades with
066: * no percentage equivalent, it is possible for the list of grades to include
067: * codes that are not included in the defaultBottomPercents map. In other
068: * words, callers shouldn't expect getDefaultBottomPercents.keySet() to be
069: * equivalent to this list.
070: * @return list of supported grade codes, ordered from highest to lowest
071: */
072: public List<String> getGrades() {
073: return grades;
074: }
075:
076: public void setGrades(List<String> grades) {
077: this .grades = grades;
078: }
079:
080: public boolean isUnavailable() {
081: return unavailable;
082: }
083:
084: public void setUnavailable(boolean unavailable) {
085: this .unavailable = unavailable;
086: }
087:
088: public Long getId() {
089: return id;
090: }
091:
092: public void setId(Long id) {
093: this .id = id;
094: }
095:
096: public int getVersion() {
097: return version;
098: }
099:
100: public void setVersion(int version) {
101: this .version = version;
102: }
103:
104: public int compareTo(Object o) {
105: return getName().compareTo(((GradingScale) o).getName());
106: }
107:
108: public String toString() {
109: return new ToStringBuilder(this).append(getUid()).toString();
110: }
111: }
|