/*[deutsch]
<p>Ermittelt das Standardwochenmodell dieses Kalenders. </p>

<p>Dieser Kalender startet historisch am Sonntag. </p>

@return  Weekmodel
488668
private static Weekmodel getDefaultWeekmodel() {

        return Weekmodel.of(Weekday.SUNDAY, 1, Weekday.SUNDAY, Weekday.SUNDAY); // historic condition

    }
116524
public static WeekDay getWeekDay(final Calendar cal) {
        return new WeekDay(getDay(cal.get(Calendar.DAY_OF_WEEK)), 0);
    }
67815
public Project.Calendars.Calendar.WorkWeeks.WorkWeek createProjectCalendarsCalendarWorkWeeksWorkWeek()
   {
      return new Project.Calendars.Calendar.WorkWeeks.WorkWeek();
   }
729946
public LocalDate ersterTag(DayOfWeek wochentag) {
        LocalDate tag = ersterTag();
        while (tag.getDayOfWeek() != wochentag) {
            tag = tag.plusDays(1);
        }
        return tag;
    }
103826
public function get_starting_weekday() {
        global $CFG;

        if (isset($CFG->calendar_startwday)) {
            $firstday = $CFG->calendar_startwday;
        } else {
            $firstday = get_string('firstdayofweek', 'langconfig');
        }

        if (!is_numeric($firstday)) {
            $startingweekday = CALENDAR_DEFAULT_STARTING_WEEKDAY;
        } else {
            $startingweekday = intval($firstday) % 7;
        }

        return get_user_preferences('calendar_startwday', $startingweekday);
    }
1127726
public Day getDayOfWeek()
   {
      Day result = null;
      if (!m_days.isEmpty())
      {
         result = m_days.iterator().next();
      }
      return result;
   }
415733
public function weekOfYear($week)
    {
        $this->setScheduleMonth(self::NONE);
        $this->setScheduleWeek($this->parseTimeParameter($week));
        $this->setScheduleDayOfMonth(self::ANY);
        $this->setScheduleDayOfWeek(Day::SUNDAY);
        $this->setScheduleHour(0);
        $this->setScheduleMinute(0);

        return $this;
    }
968924
public function startOfWeek()
    {
        $dt = $this;
        if ($dt->dayOfWeek !== static::$weekStartsAt) {
            $dt = $dt->previous(static::$weekStartsAt);
        }

        return $dt->startOfDay();
    }
279260
@Override
    public DateCalculator<LocalDate> setWorkingWeek(final WorkingWeek week) {
        if (week instanceof Jdk8WorkingWeek) {
            workingWeek = (Jdk8WorkingWeek) week;
            return this;
        }
        throw new IllegalArgumentException("Please give an instance of JodaWorkingWeek");
    }
187849
public function weekly()
    {
        $this->setScheduleMonth(self::ANY);
        $this->setScheduleWeek(self::ANY);
        $this->setScheduleDayOfMonth(self::ANY);
        $this->setScheduleDayOfWeek(Day::SUNDAY);
        $this->setScheduleHour(0);
        $this->setScheduleMinute(0);

        return $this;
    }
448910
public Set<Weekday> getSet() {

    if (this.set == null) {
      HashSet<Weekday> hashSet = new HashSet<Weekday>();
      int value = getValue().intValue();
      for (Weekday weekday : Weekday.values()) {
        int mask = (1 << weekday.ordinal());
        if ((value & mask) != 0) {
          hashSet.add(weekday);
        }
      }
      this.set = Collections.unmodifiableSet(hashSet);
    }
    return this.set;
  }
213635
public static Calendar startOfWeek(Calendar origin) {
        Calendar cal = (Calendar) origin.clone();
        cal.set(Calendar.MILLISECOND, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
        return cal;
    }
85036
public function ceilWeek($weekStartsAt = null)
    {
        if ($this->isMutable()) {
            $startOfWeek = $this->copy()->startOfWeek($weekStartsAt);

            return $startOfWeek != $this ?
                $this->startOfWeek($weekStartsAt)->addWeek() :
                $this;
        }

        $startOfWeek = $this->startOfWeek($weekStartsAt);

        return $startOfWeek != $this ?
            $startOfWeek->addWeek() :
            $this->copy();
    }
679070
public MultiDayOfTheWeek compress() {

        if (multipleDayOfTheWeek.size() == 1) {
            return this;
        }

        DayOfTheWeek start = null;
        final StringBuilder sb = new StringBuilder();
        for (int i = 0; i < multipleDayOfTheWeek.size(); i++) {
            final DayOfTheWeek current = multipleDayOfTheWeek.get(i);
            if (start == null) {
                if (i > 0) {
                    sb.append("/");
                }
                start = current;
                sb.append(start);
            } else {
                if (i == multipleDayOfTheWeek.size() - 1) {
                    sb.append(separator(start, current));
                    sb.append(current);
                } else {
                    if (multipleDayOfTheWeek.get(i + 1).previous() != current) {
                        sb.append(separator(start, current));
                        sb.append(current);
                        start = null;
                    }
                }
            }
        }
        return new MultiDayOfTheWeek(sb.toString());

    }
243002
public static WeekFields of(Locale locale) {
        Jdk8Methods.requireNonNull(locale, "locale");
        locale = new Locale(locale.getLanguage(), locale.getCountry());  // elminate variants

        // obtain these from GregorianCalendar for now
        GregorianCalendar gcal = new GregorianCalendar(locale);
        int calDow = gcal.getFirstDayOfWeek();
        DayOfWeek dow = DayOfWeek.SUNDAY.plus(calDow - 1);
        int minDays = gcal.getMinimalDaysInFirstWeek();
        return WeekFields.of(dow, minDays);
    }
459254
public Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDayWorkingTimesWorkingTime()
   {
      return new Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime();
   }
386787
public static int getWeekDay(final long time) {
        final Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(time);
        int ret = calendar.get(Calendar.DAY_OF_WEEK) - 1;
        if (ret <= 0) {
            ret = 7;
        }

        return ret;
    }