/**
  * Compares 2 time sheets
  *
  * @param ts1 the 1st timesheet
  * @param ts2 the 2nd timesheet
  * @return the difference in minutes between the 2 timesheets
  */
 private int myCompare(Time_Sheet ts1, Time_Sheet ts2) {
   if (ts1.getMinutes() == ts2.getMinutes()) {
     return ts1.getId() - ts2.getId();
   } else {
     return ts2.getMinutes() - ts1.getMinutes();
   }
 }
  /**
   * Gets all timesheets that are conflicting with a given timesheet or conflicts with the
   * conflicting timesheets and so on
   *
   * @param ts the timesheet
   * @return a the conflicting timesheets
   * @throws SQLException if an error has occured executing the sql query
   */
  private ArrayList<Time_Sheet> getAllConflicts(Time_Sheet ts) throws SQLException {
    ArrayList<Time_Sheet> conflicts = new ArrayList();
    int oldConflictsSize = 0;
    conflicts.add(ts);
    for (int i = 0; i < conflicts.size(); i++) {

      for (Time_Sheet tempTs : timeSheetAccess.getConflictingTimeSheets(conflicts.get(i))) {
        boolean alreadyIncluded = false;

        for (Time_Sheet temporaryTs : conflicts) {
          if (tempTs.getId() == temporaryTs.getId()) alreadyIncluded = true;
        }
        if (!alreadyIncluded) conflicts.add(tempTs);
      }
    }
    return conflicts;
  }