Back to project page SELP2013.
The source code is released under:
License ======= This work is licensed under the BSD 2-clause license as follows. # BSD 2-clause license Copyright (c) 2013, Sky Welch All rights reserved. Redistribution and use in source and ...
If you think the Android project SELP2013 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package uk.co.skywelch.selp2013; /* w w w. j a va2 s. c om*/ import java.util.HashMap; import java.util.Map; public class Course implements Comparable<Course> { public final String url; public final String name; public final String drps; public final String euclid; public final String acronym; public final boolean ai; public final boolean cg; public final boolean cs; public final boolean se; public final String types_string; public final int level; public final int points; public final int year; public final String deliveryperiod; public final String lecturer; public Course(String url, String name, String drps, String euclid, String acronym, boolean ai, boolean cg, boolean cs, boolean se, int level, int points, int year, String deliveryperiod, String lecturer) { this.url = url; this.name = name; this.drps = drps; this.euclid = euclid; this.acronym = acronym; this.ai = ai; this.cg = cg; this.cs = cs; this.se = se; this.level = level; this.points = points; this.year = year; this.deliveryperiod = deliveryperiod; this.lecturer = lecturer; String tTypesString = ""; if (ai) tTypesString += "AI "; if (cg) tTypesString += "CG "; if (cs) tTypesString += "CS "; if (se) tTypesString += "SE"; this.types_string = tTypesString; } @Override public String toString() { // Populate a hashmap with course contents for easy visual output HashMap<String, String> variables = new HashMap<String, String>(); variables.put("URL", url); variables.put("DRPS URL", drps); variables.put("Euclid ID", euclid); variables.put("Acronym", acronym); variables.put("AI?", Boolean.toString(ai)); variables.put("CG?", Boolean.toString(cg)); variables.put("CS?", Boolean.toString(cs)); variables.put("SE?", Boolean.toString(se)); variables.put("Level", Integer.toString(level)); variables.put("Points", Integer.toString(points)); variables.put("Delivery period", deliveryperiod); variables.put("Lecturer", lecturer); variables.put("DRPS URL", drps); String ret = "Course '" + name + "' {"; for (Map.Entry<String, String> entry : variables.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); ret += " " + key + ": '" + value + "'"; } ret += " }"; return ret; } public String getNamePlusAcronym() { if (this.name.isEmpty()) { return "Unknown" + " (" + this.acronym + ")"; } else { return this.name + " (" + this.acronym + ")"; } } @Override public int compareTo(Course another) { return acronym.compareTo(another.acronym); } }