Skip to content
Browse files

should be able to regenerate ok with existing schedule items

git-svn-id: svn+ssh://scheduler.csc.calpoly.edu/repo@2800 13b268f7-8392-4c9d-bc7d-1e80a86bc2f9
  • Loading branch information...
1 parent 55463bc commit f603100e6be7706beb8962de6c4bc18805333ac8 snavarre committed May 21, 2012
View
BIN implementation/database.db
Binary file not shown.
View
21 implementation/src/scheduler/model/algorithm/Generate.java
@@ -46,8 +46,14 @@ private static void debug (String s)
starttime = System.currentTimeMillis();
Vector<ScheduleItemDecorator> items = new Vector<ScheduleItemDecorator>();
- for (ScheduleItem si : s_items)
- items.add(new ScheduleItemDecorator(si));
+ Vector<ScheduleItem> temporaryItems = new Vector<ScheduleItem>();
+ for (ScheduleItem si : s_items) {
+// if(si.getInstructor().equals(document.getChooseForMeInstructor())) {
+// //temporaryItems.
+// }
+ //else
+ items.add(new ScheduleItemDecorator(si));
+ }
HashMap<Integer, SectionTracker> sections = new HashMap<Integer, SectionTracker>();
TimeRange bounds = new TimeRange(14, 44);
@@ -65,7 +71,8 @@ private static void debug (String s)
//Generate labs from the course list
HashMap<Integer, Course> tetheredLabs = new HashMap<Integer, Course>();
ArrayList<Course> untetheredLabs = new ArrayList<Course>();
- ArrayList<Course> indStudyCourses = new ArrayList<Course>();
+ ArrayList<Course> indStudyCourses = new ArrayList<Course>();
+
for (Course c : c_list) {
//Is a lab (or until a case found otherwise, an ACT or DIS) associated with a lecture
@@ -197,6 +204,14 @@ private static void debug (String s)
return result;
}
+ public static void findInstructorForScheduleItem() {
+
+ }
+
+ public static void findLocationforScheduleItem() {
+
+ }
+
/**
* Gets the SectionTracker associated with course 'c'. If no tracker yet
* exists for the Course, one is created and added.
View
29 implementation/src/scheduler/model/algorithm/GenerateEntryPoint.java
@@ -3,6 +3,8 @@
import java.util.Collection;
import java.util.Vector;
+import com.sun.xml.internal.bind.v2.model.core.ID;
+import scheduler.model.Day;
import scheduler.model.Course;
import scheduler.model.Document;
import scheduler.model.Instructor;
@@ -50,10 +52,29 @@
} catch (BadCourseDataException e) {
e.printStackTrace();
}
-
}
-
- //how to defensively access components of a scheduleitem?
+
+ //check schedule items - note, this should never get the staff, choose for me or tba items since they'll never be
+ //in the given lists
+ for(InstructorDecorator id : insD)
+ for(ScheduleItem s: s_items)
+ if(id.equals(s.getInstructor())) {
+ //System.out.println("+++found the instructor+++ " + s.getInstructor().getFirstName());
+ //update the instructor decorator
+ id.addWTU(new Integer(s.getCourse().getWTUInt()));
+ //System.out.println("WTUs for id: " + id.getCurWTU());
+ TimeRange tmp = new TimeRange(s.getStartHalfHour(), s.getEndHalfHour());
+ id.getAvailability().book(new Week(s.getDays()), tmp);
+ //remove the course from the course collection, it's been scheduled
+ c_list.remove(s.getCourse());
+ }
+ //update the location but don't remove it
+ for(LocationDecorator ld : locD)
+ for(ScheduleItem s : s_items)
+ if(ld.equals(s.getLocation())) {
+ TimeRange tmp = new TimeRange(s.getStartHalfHour(), s.getEndHalfHour());
+ ld.getAvailability().book(new Week(s.getDays()), tmp);
+ }
return Generate.generate(model, document, s_items, c_list, insD, locD);
}
@@ -155,7 +176,7 @@ private static void checkValid(Course c) throws BadCourseDataException, Database
//there should be an extra reqt..it can't be higher than soemthing (check)
- if(c.getNumHalfHoursPerWeek() == null || c.getNumHalfHoursPerWeekInt() <= 0)
+ if(c.getNumHalfHoursPerWeek() == null || c.getNumHalfHoursPerWeekInt() < 0)
throw new BadCourseDataException(BadCourseDataException.ConflictType.BAD_HHR_WEEK, c, "null or <= 0", "integer > 0");
//adding the reqt of 0 being valid. a course with 0 as max enrollment makes no sense to me
if(c.getMaxEnrollment() == null || c.getMaxEnrollmentInt() < 0)
View
2 implementation/test/scheduler/model/AlgorithmTest.java
@@ -42,7 +42,7 @@ public static void testThing() throws DatabaseException, BadInstructorDataExcept
for (ScheduleItem si : sis) {
System.err.println(si);
}
-
+ System.out.println("Second run with schedule items");
courses.addAll(generateAdditionalCourses(model, doc));
Vector<ScheduleItem> items = GenerateEntryPoint.generate(model, doc, sis, courses, instructors, locations);

0 comments on commit f603100

Please sign in to comment.
Something went wrong with that request. Please try again.