/** * Quotient(a - low, high - low) */ private static final long _fQuotient(long temp, int low, int high) { return _fQuotient(temp - low, high - low); }
/** * modulo(a - low, high - low) + low */ private static final int _modulo(long temp, int low, int high) { long a = temp - low; int b = high - low; return (_mod(a, b, _fQuotient(a, b)) + low) ; }
carry = _fQuotient(temp, 60); _s = _mod(temp, 60, carry); carry = _fQuotient(temp, 60); _m = _mod(temp, 60, carry); carry = _fQuotient(temp, 24); _h = _mod(temp, 24, carry);
/** * Normalizes the date by carrying over to the year any months outside 1..12 * and carrying over to the month any days outside 1..(days-in-month). */ private void _normalizeDate() { if (_M < 1 || _M > 12 || _D < 1 || _D > _maxDayInMonthFor(_CY, _M)) { // fix months first int temp = _M; _M = _modulo(temp, 1, 13); _CY = _CY + (int)_fQuotient(temp, 1, 13); // then pull days out int extradays = _D - 1; _D = 1; // then use the julian date function to fix setJulianDate(getJulianDate() + extradays); } }
_CY = _CY + sign * year + (int)_fQuotient(temp, 1, 13);
/** * Quotient(a - low, high - low) */ private static final long _fQuotient(long temp, int low, int high) { return _fQuotient(temp - low, high - low); }
/** * Quotient(a - low, high - low) */ private static final long _fQuotient(long temp, int low, int high) { return _fQuotient(temp - low, high - low); }
private void _normalizeTimeAndDate() { long carry = 0; if (hasTime()) carry = _normalizeTime(); if (hasDay()) _D += carry; if (hasDate()) { _normalizeDate(); } else if (hasMonth()) { // with incomplete dates, just months can be normalized: // days stay denormalized. if (_M < 1 || _M > 12) { int temp = _M; _M = _modulo(temp, 1, 13); if (hasYear()) _CY = _CY + (int)_fQuotient(temp, 1, 13); } } }
/** * modulo(a - low, high - low) + low */ private static final int _modulo(long temp, int low, int high) { long a = temp - low; int b = high - low; return (_mod(a, b, _fQuotient(a, b)) + low) ; }
/** * modulo(a - low, high - low) + low */ private static final int _modulo(long temp, int low, int high) { long a = temp - low; int b = high - low; return (_mod(a, b, _fQuotient(a, b)) + low) ; }
carry = _fQuotient(temp, 60); _s = _mod(temp, 60, carry); carry = _fQuotient(temp, 60); _m = _mod(temp, 60, carry); carry = _fQuotient(temp, 24); _h = _mod(temp, 24, carry);
carry = _fQuotient(temp, 60); _s = _mod(temp, 60, carry); carry = _fQuotient(temp, 60); _m = _mod(temp, 60, carry); carry = _fQuotient(temp, 24); _h = _mod(temp, 24, carry);
/** * Normalizes the date by carrying over to the year any months outside 1..12 * and carrying over to the month any days outside 1..(days-in-month). */ private void _normalizeDate() { if (_M < 1 || _M > 12 || _D < 1 || _D > _maxDayInMonthFor(_CY, _M)) { // fix months first int temp = _M; _M = _modulo(temp, 1, 13); _CY = _CY + (int)_fQuotient(temp, 1, 13); // then pull days out int extradays = _D - 1; _D = 1; // then use the julian date function to fix setJulianDate(getJulianDate() + extradays); } }
/** * Normalizes the date by carrying over to the year any months outside 1..12 * and carrying over to the month any days outside 1..(days-in-month). */ private void _normalizeDate() { if (_M < 1 || _M > 12 || _D < 1 || _D > _maxDayInMonthFor(_CY, _M)) { // fix months first int temp = _M; _M = _modulo(temp, 1, 13); _CY = _CY + (int)_fQuotient(temp, 1, 13); // then pull days out int extradays = _D - 1; _D = 1; // then use the julian date function to fix setJulianDate(getJulianDate() + extradays); } }
_CY = _CY + sign * year + (int)_fQuotient(temp, 1, 13);
_CY = _CY + sign * year + (int)_fQuotient(temp, 1, 13);
_M = _modulo(temp, 1, 13); if (hasYear()) _CY = _CY + (int)_fQuotient(temp, 1, 13);
private void _normalizeTimeAndDate() { long carry = 0; if (hasTime()) carry = _normalizeTime(); if (hasDay()) _D += carry; if (hasDate()) { _normalizeDate(); } else if (hasMonth()) { // with incomplete dates, just months can be normalized: // days stay denormalized. if (_M < 1 || _M > 12) { int temp = _M; _M = _modulo(temp, 1, 13); if (hasYear()) _CY = _CY + (int)_fQuotient(temp, 1, 13); } } }