/**
   * Schedule confrence within target duration.
   *
   * @param numbers the numbers
   * @param target the target
   * @param partial the partial
   */
  private void scheduleConfrenceWithinTargetDuration(
      List<Confrence> numbers, int target, ArrayList<Confrence> partial) {
    int s = 0;
    if (isTargetDurationAchieved) {
      return;
    }
    for (Confrence x : partial) {
      s += x.getConfrenceDuration();
    }
    if (s == target) {
      isTargetDurationAchieved = true;
      updateAppropriateSessionScheduler(partial);
      return;
    }
    if (s >= target && (s - target) <= permissibleTimeTolerance) {
      isTargetDurationAchieved = true;
      updateAppropriateSessionScheduler(partial);
      return;
    }

    for (int i = 0; i < numbers.size(); i++) {
      ArrayList<Confrence> remaining = new ArrayList<Confrence>();
      int n = numbers.get(i).getConfrenceDuration();
      for (int j = i + 1; j < numbers.size(); j++) {
        remaining.add(numbers.get(j));
      }
      ArrayList<Confrence> partial_rec = new ArrayList<Confrence>(partial);
      partial_rec.add(numbers.get(i));
      if (!isTargetDurationAchieved) {
        scheduleConfrenceWithinTargetDuration(remaining, target, partial_rec);
      }
    }
  }
 /** Start scheduling. */
 public void startScheduling() {
   currentTrack = new Tracks();
   morningSessionScheduler =
       new ConfrenceScheduler(
           ConfTrackMgmntConstant.MORNING_SESSION_TOLERANCE,
           ConfrenceSchedulerType.MORNING_SCHEDULER,
           this);
   morningSessionScheduler.scheduleConfrenceWithinTargetDuration(
       ConfTrackMgmntConstant.MORNING_SESSION_TARGET_DURATION, currentInput);
 }
 /**
  * Update track with morning schedule.
  *
  * @param morningConfrence the morning confrence
  */
 public void updateTrackWithMorningSchedule(List<Confrence> morningConfrence) {
   currentTrack.setMorningSession(morningConfrence);
   smokeAlreadyScheduledConfrence(morningConfrence);
   if (!currentInput.isEmpty()) { // more to go.lets do it in afternoon session
     afternoonSessionScheduler =
         new ConfrenceScheduler(
             ConfTrackMgmntConstant.AFTERNOON_SESSION_TOLERANCE,
             ConfrenceSchedulerType.AFTERNOON_SCHEDULER,
             this);
     afternoonSessionScheduler.scheduleConfrenceWithinTargetDuration(
         ConfTrackMgmntConstant.AFTERNOON_SESSION_TARGET_DURATION, currentInput);
   } else {
     // We are done with scheduling
     possibleTracks.add(currentTrack); // add current track to possible track list
     view.displayTrackList(possibleTracks);
   }
 }
 /**
  * Update track with after noon schedule.
  *
  * @param afternoonConfrence the afternoon confrence
  */
 public void updateTrackWithAfterNoonSchedule(List<Confrence> afternoonConfrence) {
   currentTrack.setAfterNoonSession(afternoonConfrence);
   // done for current track. Lets add this in track list
   possibleTracks.add(currentTrack);
   smokeAlreadyScheduledConfrence(afternoonConfrence);
   if (!currentInput.isEmpty()) { // more to go.lets do it in morning session of new track
     currentTrack = new Tracks();
     morningSessionScheduler =
         new ConfrenceScheduler(
             ConfTrackMgmntConstant.MORNING_SESSION_TOLERANCE,
             ConfrenceSchedulerType.MORNING_SCHEDULER,
             this);
     morningSessionScheduler.scheduleConfrenceWithinTargetDuration(
         ConfTrackMgmntConstant.MORNING_SESSION_TARGET_DURATION, currentInput);
   } else {
     // We are done with scheduling ,since current track already added to track list ,just display
     // the entire tracklist
     view.displayTrackList(possibleTracks);
   }
 }
 /**
  * Schedule confrence within target duration.
  *
  * @param targetDuration the target duration
  * @param inputConf the input conf
  */
 public void scheduleConfrenceWithinTargetDuration(
     Integer targetDuration, List<Confrence> inputConf) {
   isTargetDurationAchieved = false;
   scheduleConfrenceWithinTargetDuration(inputConf, targetDuration, new ArrayList<Confrence>());
 }