@Override
 protected CSVField csvBuildDatePatternCell(
     ClassAssignmentProxy classAssignment, PreferenceGroup prefGroup, boolean isEditable) {
   Assignment a = null;
   if (getDisplayTimetable()
       && isShowTimetable()
       && classAssignment != null
       && prefGroup instanceof Class_) {
     try {
       a = classAssignment.getAssignment((Class_) prefGroup);
     } catch (Exception e) {
       Debug.error(e);
     }
   }
   DatePattern dp = (a != null ? a.getDatePattern() : prefGroup.effectiveDatePattern());
   CSVField cell = createCell();
   if (dp != null) {
     addText(cell, dp.getName(), true);
   }
   return cell;
 }
 public ClassTimeInfo(Assignment assignment, int preference, int datePreference) {
   this(
       assignment.getClassId(),
       assignment.getDays().intValue(),
       assignment.getStartSlot().intValue(),
       assignment.getSlotPerMtg(),
       assignment.getMinutesPerMeeting(),
       preference,
       assignment.getTimePattern(),
       new ClassDateInfo(assignment, datePreference),
       assignment.getBreakTime(),
       assignment
           .getClazz()
           .getSchedulingSubpart()
           .getInstrOfferingConfig()
           .getDurationModel()
           .getDates(
               assignment.getClazz().getSchedulingSubpart().getMinutesPerWk(),
               assignment.getDatePattern(),
               assignment.getDays(),
               assignment.getMinutesPerMeeting()));
 }
Exemple #3
0
 private String[] room(Class_ clazz) {
   Assignment assgn = (iUseCommitedAssignments ? clazz.getCommittedAssignment() : null);
   if (assgn == null || assgn.getRoomLocations().isEmpty()) {
     List<RoomLocation> roomLocations = TimetableDatabaseLoader.computeRoomLocations(clazz);
     if (roomLocations.size() == clazz.getNbrRooms().intValue()) {
       String[] rooms = new String[roomLocations.size()];
       for (int x = 0; x < roomLocations.size(); x++) {
         RoomLocation r = (RoomLocation) roomLocations.get(x);
         rooms[x] = r.getName();
       }
       return rooms;
     }
     Vector roomPrefs = new Vector();
     boolean allRoomReq = true;
     for (Iterator i = clazz.effectivePreferences(BuildingPref.class).iterator(); i.hasNext(); ) {
       Preference pref = (Preference) i.next();
       roomPrefs.add(
           PreferenceLevel.prolog2abbv(pref.getPrefLevel().getPrefProlog())
               + " "
               + pref.preferenceText());
       allRoomReq = false;
     }
     for (Iterator i = clazz.effectivePreferences(RoomPref.class).iterator(); i.hasNext(); ) {
       Preference pref = (Preference) i.next();
       roomPrefs.add(
           PreferenceLevel.prolog2abbv(pref.getPrefLevel().getPrefProlog())
               + " "
               + pref.preferenceText());
       if (!PreferenceLevel.sRequired.equals(pref.getPrefLevel().getPrefProlog()))
         allRoomReq = false;
     }
     for (Iterator i = clazz.effectivePreferences(RoomFeaturePref.class).iterator();
         i.hasNext(); ) {
       Preference pref = (Preference) i.next();
       roomPrefs.add(
           PreferenceLevel.prolog2abbv(pref.getPrefLevel().getPrefProlog())
               + " "
               + pref.preferenceText());
       allRoomReq = false;
     }
     for (Iterator i = clazz.effectivePreferences(RoomGroupPref.class).iterator(); i.hasNext(); ) {
       Preference pref = (Preference) i.next();
       roomPrefs.add(
           PreferenceLevel.prolog2abbv(pref.getPrefLevel().getPrefProlog())
               + " "
               + pref.preferenceText());
       allRoomReq = false;
     }
     if (allRoomReq) {
       roomPrefs.clear();
       for (Iterator i = clazz.effectivePreferences(RoomPref.class).iterator(); i.hasNext(); ) {
         Preference pref = (Preference) i.next();
         roomPrefs.add(pref.preferenceText());
       }
     }
     String[] rooms = new String[roomPrefs.size()];
     for (int x = 0; x < roomPrefs.size(); x++) {
       rooms[x] = roomPrefs.elementAt(x).toString();
     }
     return rooms;
   }
   String[] rooms = new String[assgn.getRoomLocations().size()];
   for (int x = 0; x < assgn.getRoomLocations().size(); x++) {
     RoomLocation r = (RoomLocation) assgn.getRoomLocations().elementAt(x);
     rooms[x] = r.getName();
   }
   return rooms;
 }
Exemple #4
0
 private String[] time(Class_ clazz) {
   String dpat = "";
   DatePattern dp = clazz.effectiveDatePattern();
   if (dp != null && !dp.isDefault()) {
     if (dp.getType().intValue() == DatePattern.sTypeAlternate) dpat = " " + dp.getName();
     else {
       SimpleDateFormat dpf = new SimpleDateFormat("MM/dd");
       dpat = ", " + dpf.format(dp.getStartDate()) + " - " + dpf.format(dp.getEndDate());
     }
   }
   Assignment assgn = (iUseCommitedAssignments ? clazz.getCommittedAssignment() : null);
   if (assgn == null) {
     Set timePrefs = clazz.getEffectiveTimePreferences();
     if (timePrefs.isEmpty()) {
       if (clazz.getSchedulingSubpart().getMinutesPerWk().intValue() > 0)
         return new String[] {
           "Arr "
               + ((clazz.getSchedulingSubpart().getMinutesPerWk().intValue() + 59) / 60)
               + " Hrs"
               + dpat
         };
       else return new String[] {"Arr Hrs" + dpat};
     }
     boolean onlyOneReq = true;
     TimeLocation req = null;
     for (Iterator x = timePrefs.iterator(); onlyOneReq && x.hasNext(); ) {
       TimePref tp = (TimePref) x.next();
       TimePatternModel model = tp.getTimePatternModel();
       if (model.isExactTime()) {
         if (req != null) onlyOneReq = false;
         else {
           int length =
               ExactTimeMins.getNrSlotsPerMtg(
                   model.getExactDays(),
                   clazz.getSchedulingSubpart().getMinutesPerWk().intValue());
           int breakTime =
               ExactTimeMins.getBreakTime(
                   model.getExactDays(),
                   clazz.getSchedulingSubpart().getMinutesPerWk().intValue());
           req =
               new TimeLocation(
                   model.getExactDays(),
                   model.getExactStartSlot(),
                   length,
                   PreferenceLevel.sIntLevelNeutral,
                   0,
                   dp.getUniqueId(),
                   dp.getName(),
                   dp.getPatternBitSet(),
                   breakTime);
         }
       } else {
         for (int d = 0; d < model.getNrDays(); d++)
           for (int t = 0; onlyOneReq && t < model.getNrTimes(); t++) {
             if (PreferenceLevel.sRequired.equals(model.getPreference(d, t))) {
               if (req != null) onlyOneReq = false;
               else {
                 req =
                     new TimeLocation(
                         model.getDayCode(d),
                         model.getStartSlot(t),
                         model.getSlotsPerMtg(),
                         PreferenceLevel.prolog2int(model.getPreference(d, t)),
                         0,
                         dp.getUniqueId(),
                         dp.getName(),
                         dp.getPatternBitSet(),
                         model.getBreakTime());
               }
             }
           }
       }
     }
     if (onlyOneReq && req != null)
       return new String[] {
         req.getDayHeader()
             + " "
             + req.getStartTimeHeader(CONSTANTS.useAmPm())
             + " - "
             + req.getEndTimeHeader(CONSTANTS.useAmPm())
             + dpat
       };
     Vector t = new Vector();
     for (Iterator x = timePrefs.iterator(); x.hasNext(); ) {
       TimePref tp = (TimePref) x.next();
       String tx = tp.getTimePatternModel().toString();
       for (StringTokenizer s = new StringTokenizer(tx, ","); s.hasMoreTokens(); )
         t.add(s.nextToken().trim());
     }
     String[] time = new String[t.size()];
     for (int x = 0; x < time.length; x++) time[x] = t.elementAt(x) + dpat;
     return time;
   }
   TimeLocation t = assgn.getTimeLocation();
   return new String[] {
     t.getDayHeader()
         + " "
         + t.getStartTimeHeader(CONSTANTS.useAmPm())
         + " - "
         + t.getEndTimeHeader(CONSTANTS.useAmPm())
         + dpat
   };
 }