/*[deutsch]
<p>Ermittelt die Anzahl der Tage, die zu dieser Wochentagsspanne geh&ouml;ren. </p>

@return  count of days in range {@code 1-7}
162939
public int length() {

        int days = 1;
        Weekday current = this.start;

        while (current != this.end) {
            days++;
            current = current.next();
        }

        return days;

    }
876576
public static Long getSunday() {
		cal.setTimeInMillis(System.currentTimeMillis());
		cal.add(Calendar.DATE, -dayOfWeek() + 7);
		return cal.getTimeInMillis();
	}
1189933
public static int weekCount(Date start, Date end) {
		final Calendar startCalendar = Calendar.getInstance();
		startCalendar.setTime(start);
		final Calendar endCalendar = Calendar.getInstance();
		endCalendar.setTime(end);

		final int startWeekofYear = startCalendar.get(Calendar.WEEK_OF_YEAR);
		final int endWeekofYear = endCalendar.get(Calendar.WEEK_OF_YEAR);

		int count = endWeekofYear - startWeekofYear + 1;

		if (Calendar.SUNDAY != startCalendar.get(Calendar.DAY_OF_WEEK)) {
			count--;
		}

		return count;
	}
67965
public int getSeconds() {
		// TODO ahai 未做测试
		Calendar cld = Calendar.getInstance();
		cld.set(Calendar.DAY_OF_WEEK, this.weekday + 1);
		cld.set(Calendar.HOUR_OF_DAY, this.hour);
		cld.set(Calendar.MINUTE, this.minute);
		cld.set(Calendar.SECOND, this.second);
		long time = cld.getTimeInMillis();
		// System.out.println("time:" +
		// DateUtil.getTime(DateUtil.toDate(time)));
		long diff = time - System.currentTimeMillis();
		if (diff <= 0) {// 一定要小于等于0
			// 本周的时间已过，下周再执行
			diff += 7 * 24 * 60 * 60 * 1000L;
		}
		int seconds = (int) (diff / 1000);
		return seconds;
	}
464381
public java.util.Map<String, String> getMonday() {
        if (monday == null) {
            monday = new com.amazonaws.internal.SdkInternalMap<String, String>();
        }
        return monday;
    }
54764
public final int compareTo(final Dur arg0) {
        int result;
        if (isNegative() != arg0.isNegative()) {
            // return Boolean.valueOf(isNegative()).compareTo(Boolean.valueOf(arg0.isNegative()));
            // for pre-java 1.5 compatibility..
            if (isNegative()) {
                return Integer.MIN_VALUE;
            }
            else {
                return Integer.MAX_VALUE;
            }
        }
        else if (getWeeks() != arg0.getWeeks()) {
            result = getWeeks() - arg0.getWeeks();
        }
        else if (getDays() != arg0.getDays()) {
            result = getDays() - arg0.getDays();
        }
        else if (getHours() != arg0.getHours()) {
            result = getHours() - arg0.getHours();
        }
        else if (getMinutes() != arg0.getMinutes()) {
            result = getMinutes() - arg0.getMinutes();
        }
        else {
            result = getSeconds() - arg0.getSeconds();
        }
        // invert sense of all tests if both durations are negative
        if (isNegative()) {
            return -result;
        }
        else {
            return result;
        }
    }
895141
public NumberExpression<Long> count() {
        if (count == null) {
            count = Expressions.numberOperation(Long.class, Ops.AggOps.COUNT_AGG, mixin);
        }
        return count;
    }
367930
public java.util.Map<String, String> getSaturday() {
        if (saturday == null) {
            saturday = new com.amazonaws.internal.SdkInternalMap<String, String>();
        }
        return saturday;
    }
1373638
public long toMillis() {
		long totalSeconds = 0;

		if (weeks != null) {
			totalSeconds += 60L * 60 * 24 * 7 * weeks;
		}
		if (days != null) {
			totalSeconds += 60L * 60 * 24 * days;
		}
		if (hours != null) {
			totalSeconds += 60L * 60 * hours;
		}
		if (minutes != null) {
			totalSeconds += 60L * minutes;
		}
		if (seconds != null) {
			totalSeconds += seconds;
		}
		if (prior) {
			totalSeconds *= -1;
		}

		return totalSeconds * 1000;
	}
558746
public DayOfTheWeek previous() {
        if (this == PH) {
            return null;
        }
        final int nextId = id - 1;
        for (final DayOfTheWeek dow : ALL) {
            if (dow.id == nextId) {
                return dow;
            }
        }
        return SUN;
    }
325034
@Override
	public double getDaycount(LocalDate startDate, LocalDate endDate) {
		if(startDate.isAfter(endDate)) {
			return -getDaycount(endDate,startDate);
		}

		return daysBetween(startDate, endDate);
	}
1274684
public static int dayOfWeek(long day) {
        long[] remainder = new long[1];
        floorDivide(day + Calendar.THURSDAY, 7, remainder);
        int dayOfWeek = (int)remainder[0];
        dayOfWeek = (dayOfWeek == 0) ? 7 : dayOfWeek;
        return dayOfWeek;
    }
5179
public static PeriodFormatter alternateExtendedWithWeeks() {
        if (cAlternateExtendedWihWeeks == null) {
            cAlternateExtendedWihWeeks = new PeriodFormatterBuilder()
                .appendLiteral("P")
                .printZeroAlways()
                .minimumPrintedDigits(4)
                .appendYears()
                .appendSeparator("-")
                .minimumPrintedDigits(2)
                .appendPrefix("W")
                .appendWeeks()
                .appendSeparator("-")
                .appendDays()
                .appendSeparatorIfFieldsAfter("T")
                .appendHours()
                .appendSeparator(":")
                .appendMinutes()
                .appendSeparator(":")
                .appendSecondsWithOptionalMillis()
                .toFormatter();
        }
        return cAlternateExtendedWihWeeks;
    }
516701
public static Long getMonth1stDay() {
		cal.setTimeInMillis(System.currentTimeMillis());
		cal.set(Calendar.DATE, 1);
		return cal.getTimeInMillis();
	}
53182
public boolean evaluateSprintLength(String startDate, String endDate, int maxKanbanIterationLength) {
		boolean sprintIndicator = false;
		Calendar startCalendar = Calendar.getInstance();
		Calendar endCalendar = Calendar.getInstance();

		if (!StringUtils.isAnyEmpty(startDate) && !StringUtils.isAnyEmpty(endDate)) {

			Date strDt = convertIntoDate(startDate.substring(0, 4) + "-" + startDate.substring(5, 7) + "-" + startDate.substring(8, 10), "yyyy-MM-dd" );
			Date endDt = convertIntoDate(endDate.substring(0, 4) + "-" + endDate.substring(5, 7) + "-" + endDate.substring(8, 10), "yyyy-MM-dd");

			if (strDt != null && endDate != null) {
				startCalendar.setTime(strDt);
				endCalendar.setTime(endDt);

				long diffMill = endCalendar.getTimeInMillis() - startCalendar.getTimeInMillis();
				long diffDays = TimeUnit.DAYS.convert(diffMill, TimeUnit.MILLISECONDS);

				if (diffDays <= maxKanbanIterationLength) {
					// Scrum-enough
					sprintIndicator = true;
				}
			}
		} else {
			// Default to kanban
			sprintIndicator = false;

		}

		return sprintIndicator;
	}
1359650
public long toNanoOfDay() {
        long total = hour * NANOS_PER_HOUR;
        total += minute * NANOS_PER_MINUTE;
        total += second * NANOS_PER_SECOND;
        total += nano;
        return total;
    }
1057652
public static int dayOfWeek(){
		setTime();
		int dayofweek = cal.get(Calendar.DAY_OF_WEEK) - 1;
		if (dayofweek == 0) {
			dayofweek = 7;
		}
		return dayofweek;
	}