1 week in second
978831
@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler("favicon.ico")
			.addResourceLocations("/assets/favicon.ico").setCachePeriod(RESOURCE_CACHE_PERIOD);
		registry.addResourceHandler("robots.txt")
			.addResourceLocations("assets/robots.txt").setCachePeriod(RESOURCE_CACHE_PERIOD);
		registry.addResourceHandler("/assets/**")
			.addResourceLocations("/assets/").setCachePeriod(RESOURCE_CACHE_PERIOD);
		registry.addResourceHandler("/Documentation/**")
			.addResourceLocations("/Documentation/").setCachePeriod(RESOURCE_CACHE_PERIOD);
	}
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;
	}
305202
private void computePeriod(InfoTree it1, int aVp, int aNextVp, InfoTree it2, int aStrategy) {

		int fTreeSize = it1.getSize();
		int gTreeSize = it2.getSize();

		int vpPreorder = it1.info[POST2_PRE][aVp];
		int vpRevPreorder = fTreeSize - 1 - aVp;
		int vpSize = it1.info[POST2_SIZE][aVp];

		int gSize = it2.info[POST2_SIZE][it2.getCurrentNode()];
		int gPreorder = it2.info[POST2_PRE][it2.getCurrentNode()];
		int gRevPreorder = gTreeSize - 1 - it2.getCurrentNode();

		int nextVpPreorder = -1;
		int nextVpRevPreorder = -1;
		int nextVpSize = -1;
		// count k and assign next vp values
		int k;
		if (aNextVp != -1) {
			nextVpPreorder = it1.info[POST2_PRE][aNextVp];
			nextVpRevPreorder = fTreeSize - 1 - aNextVp;
			nextVpSize = it1.info[POST2_SIZE][aNextVp];
			// if strategy==LEFT use preorder to count number of left deletions from vp to
			// vp-1
			// if strategy==RIGHT use reversed preorder
			k = aStrategy == LEFT ? nextVpPreorder - vpPreorder
					: nextVpRevPreorder - vpRevPreorder;
			if (aStrategy != previousStrategy) {
				computeIJTable(it2, gPreorder, gRevPreorder, gSize, aStrategy, gTreeSize);
			}
		} else {
			k = 1;
			computeIJTable(it2, gPreorder, gRevPreorder, gSize, aStrategy, gTreeSize);
		}

		int realStrategy = it1.info[POST2_STRATEGY][aVp];

		boolean switched = it1.isSwitched();

		double[][] tTable_copy = t.clone();

		// Q and T are visible for every i
		double[] qTable = new double[k];

		// if aVp is a leaf => precompute table T - edit distance betwen EMPTY and all
		// subforests of G

		// check if nextVp is the only child of vp
		if (vpSize - nextVpSize == 1) {
			// update delta from T table => dist between Fvp-1 and G was computed in
			// previous compute period
			if (gSize == 1) {
				setDeltaValue(it1.info[PRE2_POST][vpPreorder], it2.info[PRE2_POST][gPreorder],
						vpSize - 1, switched);
			} else {
				setDeltaValue(it1.info[PRE2_POST][vpPreorder], it2.info[PRE2_POST][gPreorder],
						t[1][0], switched);
			}
		}

		double[][] sTable;// = new double[k][gTreeSize+1];

		int gijForestPreorder;
		int previousI;
		int fForestPreorderKPrime;
		int jPrime;
		int kBis;
		int jOfIminus1;
		int gijOfIMinus1Preorder;
		int jOfI;
		double deleteFromLeft;
		double deleteFromRight;
		double match;
		int fLabel;
		int gLabel;

		// Q and T are visible for every i
		for (int i = gSize - 1; i >= 0; i--) {

			// jOfI was already computed once in spfH
			jOfI = jOfI(it2, i, gSize, gRevPreorder, gPreorder, aStrategy, gTreeSize);

			// when strategy==BOTH first LEFT then RIGHT is done

			counter += realStrategy == BOTH && aStrategy == LEFT ? (k - 1) * (jOfI + 1)
					: k * (jOfI + 1);

			// compute table S - visible for actual i

			sTable = new double[k][jOfI + 1]; // initialized outside loop? -> doesn't work

			for (int kPrime = 1; kPrime <= k; kPrime++) {

				fForestPreorderKPrime = aStrategy == LEFT ? vpPreorder + (k - kPrime)
						: it1.info[POST2_PRE][fTreeSize - 1 - (vpRevPreorder + (k - kPrime))];
				kBis = kPrime - it1.info[POST2_SIZE][it1.info[PRE2_POST][fForestPreorderKPrime]];

				// reset the minimum arguments' values
				deleteFromRight = costIns;
				deleteFromLeft = costDel;
				match = 0;

				match += aStrategy == LEFT ? kBis + nextVpSize : vpSize - k + kBis;

				if ((i + jOfI) == (gSize - 1)) {
					deleteFromRight += (vpSize - (k - kPrime));
				} else {
					deleteFromRight += qTable[kPrime - 1];
				}

				fLabel = it1.info[POST2_LABEL][it1.info[PRE2_POST][fForestPreorderKPrime]];

				for (int j = jOfI; j >= 0; j--) {
					// count dist(FkPrime, Gij) with min

					// delete from left

					gijForestPreorder = aStrategy == LEFT ? IJ[i][j]
							: it2.info[POST2_PRE][gTreeSize - 1 - IJ[i][j]];

					if (kPrime == 1) {
						// if the direction changed from the previous period to this one use i and j
						// of
						// previous strategy

						// since T is overwritten continously, thus use T_copy for getting values
						// from
						// previous period

						if (aStrategy != previousStrategy) {
							if (aStrategy == LEFT) {
								previousI = gijForestPreorder - gPreorder; // minus preorder of G
							} else {
								previousI = gTreeSize - 1
										- it2.info[RPOST2_POST][gTreeSize - 1 - gijForestPreorder]
										- gRevPreorder; // minus rev preorder of G
							}
							deleteFromLeft += tTable_copy[previousI][i + j - previousI];
						} else {
							deleteFromLeft += tTable_copy[i][j];
						}

					} else {
						deleteFromLeft += sTable[kPrime - 1 - 1][j];
					}

					// match

					match += switched
							?
							delta[it2.info[PRE2_POST][gijForestPreorder]][it1.info[PRE2_POST][fForestPreorderKPrime]]
							:
							delta[it1.info[PRE2_POST][fForestPreorderKPrime]][it2.info[PRE2_POST][gijForestPreorder]];

					jPrime = j + it2.info[POST2_SIZE][it2.info[PRE2_POST][gijForestPreorder]];

					// if root nodes of L/R Fk' and L/R Gij have different labels add the match cost
					gLabel = it2.info[POST2_LABEL][it2.info[PRE2_POST][gijForestPreorder]];

					if (fLabel != gLabel) {
						match += costMatch;
					}

					// this condition is checked many times but is not satisfied only once
					if (j != jOfI) {
						// delete from right
						deleteFromRight += sTable[kPrime - 1][j + 1];
						if (kBis == 0) {
							if (aStrategy != previousStrategy) {
								previousI = aStrategy == LEFT ? IJ[i][jPrime] - gPreorder
										: IJ[i][jPrime] - gRevPreorder;
								match += tTable_copy[previousI][i + jPrime - previousI];
							} else {
								match += tTable_copy[i][jPrime];
							}
						} else if (kBis > 0) {
							match += sTable[kBis - 1][jPrime];
						} else {
							match += gSize - (i + jPrime);
						}

					}

					// fill S table
					sTable[kPrime - 1][j] = (deleteFromLeft < deleteFromRight)
							? ((deleteFromLeft < match) ? deleteFromLeft : match)
							: ((deleteFromRight < match) ? deleteFromRight : match);

					// reset the minimum arguments' values
					deleteFromRight = costIns;
					deleteFromLeft = costDel;
					match = 0;
				}
			}

			// compute table T => add row to T
			if (realStrategy == BOTH && aStrategy == LEFT) {
				t[i] = sTable[k - 1 - 1];
			} else {
				t[i] = sTable[k - 1];
			}

			if (i > 0) {
				// compute table Q
				jOfIminus1 =
						jOfI(it2, i - 1, gSize, gRevPreorder, gPreorder, aStrategy, gTreeSize);
				if (jOfIminus1 <= jOfI) {
					for (int x = 0;
					     x < qTable.length; x++) { // copy whole column | qTable.length=k
						qTable[x] = sTable[x][jOfIminus1];
					}
				}

				// fill table delta
				if (i + jOfIminus1 < gSize) {

					gijOfIMinus1Preorder = aStrategy == LEFT
							? it2.info[POST2_PRE][gTreeSize - 1 - (gRevPreorder + (i - 1))]
							: gPreorder + (i - 1);

					// If Fk from Fk-1 differ with a single node,
					// then Fk without the root node is Fk-1 and the distance value has to be taken
					// from previous T table.
					if (k - 1 - 1 < 0) {
						if (aStrategy != previousStrategy) {
							previousI = aStrategy == LEFT ? IJ[i][jOfIminus1] - gPreorder
									: IJ[i][jOfIminus1] - gRevPreorder;
							setDeltaValue(it1.info[PRE2_POST][vpPreorder],
									it2.info[PRE2_POST][gijOfIMinus1Preorder],
									tTable_copy[previousI][i + jOfIminus1 - previousI], switched);
						} else {
							setDeltaValue(it1.info[PRE2_POST][vpPreorder],
									it2.info[PRE2_POST][gijOfIMinus1Preorder],
									tTable_copy[i][jOfIminus1], switched);
						}
					} else {
						setDeltaValue(it1.info[PRE2_POST][vpPreorder],
								it2.info[PRE2_POST][gijOfIMinus1Preorder],
								sTable[k - 1 - 1][jOfIminus1], switched);
					}
				}
			}

		}
		previousStrategy = aStrategy;
	}
660126
function(d) {
		"use strict";

		if (this.options.weekStartOnMonday === false) {
			return d.getDay();
		}
		return d.getDay() === 0 ? 6 : (d.getDay()-1);
	}
314578
def _workdaycount(self, date1, date2):
        
        assert date2 >= date1
        date1wd = date1.weekday()
        date2wd = date2.weekday()
        if not self.weekdaymap[date2wd].isworkday:
            date2 += datetime.timedelta(days=self.weekdaymap[date2wd].offsetprev)
            date2wd = self.weekdaymap[date2wd].prevworkday
        if date2 <= date1:
            return 0
        
        nw, nd = divmod((date2 - date1).days, 7)
        ndays = nw * len(self.workdays)
        if nd > 0:
            date1wd = date1.weekday()
            date2wd = date2.weekday()
            while date1wd != date2wd:
                ndays += 1
                date1wd = self.weekdaymap[date1wd].nextworkday
        return ndays
172680
function (week, today) {
		var now = new Date();
		if (today) {
			now.setDate(today);
		}
		week = 7 - (week || now.getDay());

		return new Date(now.getTime() + ONE_DAY_MILLISECONDS * week);
	}
1067524
public static boolean isSameWeek(final Date date1, final Date date2) {
        final Calendar cal1 = Calendar.getInstance();
        cal1.setFirstDayOfWeek(Calendar.MONDAY);
        cal1.setTime(date1);

        final Calendar cal2 = Calendar.getInstance();
        cal2.setFirstDayOfWeek(Calendar.MONDAY);
        cal2.setTime(date2);

        return cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA)
                && cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)
                && cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR);
    }
434354
function getWeeks(dates) {
  const weeksLength = Math.ceil(dates.length / 7);
  const weeks = [];
  for (let i = 0; i < weeksLength; i++) {
    weeks[i] = [];
    for (let x = 0; x < 7; x++) {
      weeks[i].push(dates[i * 7 + x]);
    }
  }
  return weeks;
}
756802
public static boolean isSunday(int column, int firstDayOfWeek) {
        return (firstDayOfWeek == Time.SUNDAY && column == 0)
                || (firstDayOfWeek == Time.MONDAY && column == 6)
                || (firstDayOfWeek == Time.SATURDAY && column == 1);
    }
763759
function (d) {
		"use strict";

		if (typeof d === "number") {
			d = new Date(d);
		}

		var monthFirstWeekNumber = this.getWeekNumber(new Date(d.getFullYear(), d.getMonth()));
		return this.getWeekNumber(d) - monthFirstWeekNumber - 1;
	}
1311502
public void incrementCount(F first, S second, double inc) {
        Counter<S> counter = maps.get(first);
        if (counter == null) {
            counter = new Counter<S>();
            maps.put(first, counter);
        }

        counter.incrementCount(second, inc);
    }
572997
private void setWeekCountData(Locale desiredLocale)
    {
        /* try to get the Locale data from the cache */
        int[] data = cachedLocaleData.get(desiredLocale);
        if (data == null) {  /* cache miss */
            data = new int[2];
            // BEGIN Android-changed: Use ICU4C to get week data.
            // data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
            // data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
            LocaleData localeData = LocaleData.get(desiredLocale);
            data[0] = localeData.firstDayOfWeek.intValue();
            data[1] = localeData.minimalDaysInFirstWeek.intValue();
            // END Android-changed: Use ICU4C to get week data.
            cachedLocaleData.putIfAbsent(desiredLocale, data);
        }
        firstDayOfWeek = data[0];
        minimalDaysInFirstWeek = data[1];
    }
290267
def P1(self, value):
        """"""
        if value < self.P2:
            self._P1 = value
        else:
            raise InvalidFirstDisparityChangePenaltyError("P1 must be less "
                                                          "than P2.")
        self._replace_bm()
492405
def next_week_day(base_date, weekday):
    
    day_of_week = base_date.weekday()
    end_of_this_week = base_date + timedelta(days=6 - day_of_week)
    day = end_of_this_week + timedelta(days=1)
    while day.weekday() != weekday:
        day = day + timedelta(days=1)
    return day
1291535
function(seq1, seq2, eq){

    var N = seq1.length,
        M = seq2.length,
        MAX = N + M,
        stepMap = Array.apply(null, {length: M+N+1}).map(function(){return [];}),
        furthestReaching = [],
        dist = -1;

    eq = eq || defaultEqual;

    furthestReaching[MAX + 1] = 0;

    // caculate min distance & log each step
    for(var D = 0; D <= MAX && dist === -1; D++){
        for(var k = -D, x, y, step; k <= D && dist === -1; k+=2){
            if(k === -D || (k !== D && furthestReaching[k - 1 + MAX] < furthestReaching[k + 1 + MAX])){
                x = furthestReaching[k + 1 + MAX];
                step = STEP_INSERT;
            }else{
                x = furthestReaching[k - 1 + MAX] + 1;
                step = STEP_REMOVE;
            }

            y = x - k;
            stepMap[x][y] = step;

            while(x < N && y < M && eq(seq1[x], seq2[y])){
                x++;
                y++;
                stepMap[x][y] = STEP_NOCHANGE;
            }

            furthestReaching[k + MAX] = x;

            if(x >= N && y >= M){
                dist = D;
            }
        }
    }

    return stepMap;
}
748508
private static int weekRange(int weekBasedYear) {
        LocalDate date = LocalDate.of(weekBasedYear, 1, 1);
        // 53 weeks if year starts on Thursday, or Wed in a leap year
        if (date.getDayOfWeek() == THURSDAY || (date.getDayOfWeek() == WEDNESDAY && date.isLeapYear())) {
            return 53;
        }
        return 52;
    }
877489
def move_datetime_week(dt, direction, num_shifts):
    
    delta = relativedelta(weeks=+num_shifts)
    return _move_datetime(dt, direction, delta)