📄 schedulehelpers.java
字号:
/**
* Classroom Scheduler
* Copyright (C) 2004 Colin Archibald, Ph.D.
* https://sourceforge.net/projects/cr-scheduler/
*
* Licensed under the Academic Free License version 2.0
*
*/
// This should be deprecated now, it has been replaced by Summary.java - Kyle
package application;
import java.util.*;
import java.text.*;
import resources.*;
/**
*
* @author Colin
*/
public class ScheduleHelpers {
// this is a real approximation since capacity is based on the rooms, and the
// rooms might not be scheduled yet.
// Fixed to return the actual count, not sure about the above comment, as the
// room should be set on the SchedCourse when its created.
/* public static int totalCapacity(){
Vector courses = Schedule.getSchedule().getSchedCourses();
int total = 0;
for(int i = 0; i < courses.size(); i++) {
SchedCourse course = (SchedCourse) courses.elementAt(i);
total += course.getClassroom().getCapacity();
}
return total;
} */
/** counts how many full time faculty are in the schedule
* @returns the number of full time faculty in the schedule
*
*/
/* public static int fullTimeFacultyCount(){
Schedule schedule = Schedule.getSchedule();
Vector profs = schedule.getProfessors();
int count = 0;
for(int i = 0; i < profs.size(); i++) {
if(((Professor) profs.elementAt(i)).getStatus() == Professor.FULL_TIME) {
count++;
}
}
return count;
} */
/**
* @returns the number of courses taught by full timers
*/
/* public static int coursesFullTime(){
Schedule schedule = Schedule.getSchedule();
int count = 0;
//schedule.buildSummary();
for(Enumeration enum = schedule.getProfSummarys().elements(); enum.hasMoreElements();) {
ProfessorSummary profSummary = (ProfessorSummary) enum.nextElement();
if(profSummary.getProfessor().getStatus() == Professor.FULL_TIME) {
count += profSummary.getSections();
}
}
return count;
}
public static int coursesAdjunct(){
Schedule schedule = Schedule.getSchedule();
int count = 0;
//schedule.buildSummary();
for(Enumeration enum = schedule.getProfSummarys().elements(); enum.hasMoreElements();) {
ProfessorSummary profSummary = (ProfessorSummary) enum.nextElement();
if(profSummary.getProfessor().getStatus() == Professor.ADJUNCT) {
count += profSummary.getSections();
}
}
return count;
} */
/** counts how many adjunct faculty are in the schedule
* @returns the number of full time faculty in the schedule
*
*/
/* public static int adjunctFacultyCount(){
Schedule schedule = Schedule.getSchedule();
Vector profs = schedule.getProfessors();
int count = 0;
for(int i = 0; i < profs.size(); i++) {
if(((Professor) profs.elementAt(i)).getStatus() == Professor.ADJUNCT) {
count++;
}
}
return count;
}
public static int totalCreditHours() {
Schedule schedule = Schedule.getSchedule();
ProfessorSummary totals = (ProfessorSummary) schedule.getProfSummarys().get(ProfessorSummary.TOTAL);
return totals.getCreditHours();
}
public static String fullTimerSummary(){
Schedule schedule = Schedule.getSchedule();
String summary = "";
ProfessorSummary totalsft = (ProfessorSummary) schedule.getProfSummarys().get(ProfessorSummary.TOTAL_FULL);
ProfessorSummary totalsat = (ProfessorSummary) schedule.getProfSummarys().get(ProfessorSummary.TOTAL);
summary += "Full Time Faculty Scheduled\n\n";
summary += "Name\t\t\tSections\tCreditHours\n";
summary += "-----\t\t\t-------\t----------\n"; // Non fixed width font makes this odd
for(Enumeration enum = schedule.getProfSummarys().elements(); enum.hasMoreElements();) {
ProfessorSummary profSummary = (ProfessorSummary) enum.nextElement();
if(profSummary.getProfessor().getStatus() == Professor.FULL_TIME) {
summary += profSummary + "\n";
}
}
summary += "-----\t\t\t-------\t----------\n";
summary += totalsft + "\n";
if(totalsat.getSections() > 0) {
summary += "Percent Full Time:\t\t" + NumberFormat.getPercentInstance().format((double) totalsft.getSections() / totalsat.getSections()) + "\t";
summary += NumberFormat.getPercentInstance().format((double) totalsft.getCreditHours() / totalsat.getCreditHours()) + "\n";
}
return summary;
} */
/** creates a summary of what a prof is scheduled for
* @returns a one liner String for a particular prof
*/
/* private static String fullTimerSummary(Professor prof){
Schedule schedule = Schedule.getSchedule();
//schedule.buildSummary();
if(!schedule.getProfSummarys().containsKey(prof)){
return "Summary for " + prof + " not found!";
}
return schedule.getProfSummarys().get(prof).toString();
} */
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -