/**
  * Metoda s³u¿y do obliczania iloœci dni, w których pracowa³ ankieter od pewnej ustalonej daty
  *
  * @param interviewer
  * @param from
  * @return
  */
 private float numberOfDaysInWork(Interviewer interviewer, GregorianCalendar from) {
   float days = 0;
   List<Pair<GregorianCalendar, GregorianCalendar>> outOfWork = interviewer.getOutOfWorkTime();
   if (interviewer.isActive()) {
     Date now = new Date();
     days += daysBetween(from.getTime(), now);
     for (Pair<GregorianCalendar, GregorianCalendar> entr : outOfWork) {
       if (from.compareTo(entr.getFirst()) <= 0) {
         days -= daysBetween(entr.getFirst().getTime(), entr.getSecond().getTime());
       }
       if (from.compareTo(entr.getFirst()) >= 0 && from.compareTo(entr.getSecond()) <= 0) {
         days -= daysBetween(from.getTime(), entr.getSecond().getTime());
       }
     }
   } else {
     days +=
         daysBetween(interviewer.getHiredDay().getTime(), interviewer.getRelieveDay().getTime());
     for (Pair<GregorianCalendar, GregorianCalendar> entr : outOfWork) {
       if (from.compareTo(entr.getFirst()) <= 0) {
         days -= daysBetween(entr.getFirst().getTime(), entr.getSecond().getTime());
       }
       if (from.compareTo(entr.getFirst()) >= 0 && from.compareTo(entr.getSecond()) <= 0) {
         days -= daysBetween(from.getTime(), entr.getSecond().getTime());
       }
     }
   }
   return days;
 }
  /**
   * Metoda s³u¿y do obliczenia liczby dni przepracowanych przez ankietera w podanym okresie.
   * Rozwa¿amy cztery przypadki nak³adania siê dat.
   *
   * @param interviewer
   * @param from
   * @param to
   * @return
   */
  private float numberOfDaysInWork(
      Interviewer interviewer, GregorianCalendar from, GregorianCalendar to) {
    float days = 0;
    List<Pair<GregorianCalendar, GregorianCalendar>> outOfWork = interviewer.getOutOfWorkTime();
    days += daysBetween(from.getTime(), to.getTime());
    for (Pair<GregorianCalendar, GregorianCalendar> entr : outOfWork) {
      if (from.compareTo(entr.getFirst()) <= 0
          && to.compareTo(entr.getSecond()) >= 0) { // nie nak³adaja siê
        days -= daysBetween(entr.getFirst().getTime(), entr.getSecond().getTime());
      }
      if (from.compareTo(entr.getFirst()) >= 0
          && to.compareTo(entr.getSecond()) >= 0
          && from.compareTo(entr.getSecond()) <= 0) { // from jest w srodku okresu niepracuj¹cego
        days -= daysBetween(from.getTime(), entr.getSecond().getTime());
      }
      if (from.compareTo(entr.getFirst()) <= 0
          && to.compareTo(entr.getSecond()) <= 0
          && entr.getFirst().compareTo(to) <= 0) { // to jest w œrodku okresu niepracuj¹cego
        days -= daysBetween(entr.getFirst().getTime(), to.getTime());
      }
      if (from.compareTo(entr.getFirst()) >= 0
          && to.compareTo(entr.getSecond()) <= 0) { // obie daty sa w srodku okresu niepracuj¹cego
        days -= daysBetween(from.getTime(), to.getTime());
      }
    }

    return days;
  }