예제 #1
0
  private void calculate() {
    DateHolder dateHolder = new DateHolder(cal, DatePrecision.DAY);
    year = dateHolder.getYear();
    month = dateHolder.getMonth();
    dateHolder.setBeginOfMonth();
    begin = dateHolder.getDate(); // Storing begin of month.
    dateHolder.setEndOfMonth();
    end = dateHolder.getDate(); // Storing end of month.
    dateHolder.setDate(begin); // reset to begin of month
    dateHolder.computeTime();
    dateHolder.setBeginOfWeek(); // get first week (with days of previous month)

    weeks = new ArrayList<WeekHolder>();
    do {
      WeekHolder week = new WeekHolder(dateHolder.getCalendar(), month);
      weeks.add(week);
      dateHolder.add(Calendar.WEEK_OF_YEAR, 1);
    } while (dateHolder.getMonth() == month);
  }
예제 #2
0
 /**
  * Sets the date to the beginning of the year (first day of year) and calls setBeginOfDay.
  *
  * @see #setBeginOfDay()
  */
 public DateHolder setBeginOfYear() {
   calendar.set(Calendar.MONTH, Calendar.JANUARY);
   setBeginOfMonth();
   return this;
 }