001/*
002 * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
003 *
004 * Based in London, we are world leaders in the design and development
005 * of bespoke applications for the securities financing markets.
006 *
007 * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
008 *           ___  _     _           _   _          _
009 *          / _ \| |__ (_) ___  ___| |_| |    __ _| |__
010 *         | | | | '_ \| |/ _ \/ __| __| |   / _` | '_ \
011 *         | |_| | |_) | |  __/ (__| |_| |__| (_| | |_) |
012 *          \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
013 *                   |__/
014 *
015 *                     www.ObjectLab.co.uk
016 *
017 * $Id$
018 *
019 * Copyright 2006 the original author or authors.
020 *
021 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
022 * use this file except in compliance with the License. You may obtain a copy of
023 * the License at
024 *
025 * http://www.apache.org/licenses/LICENSE-2.0
026 *
027 * Unless required by applicable law or agreed to in writing, software
028 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
029 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
030 * License for the specific language governing permissions and limitations under
031 * the License.
032 */
033package net.objectlab.kit.datecalc.common;
034
035/**
036 * This will be called to determine whether the date should be moved according
037 * to the special algorithm used.
038 *
039 * @author Benoit Xhenseval
040 *
041 * @param <E>
042 *            a representation of a date, typically JDK: Date, Calendar;
043 *            Joda:LocalDate, YearMonthDay
044 *
045 */
046public interface HolidayHandler<E> {
047    /**
048     * If the current date of the give calculator is a non-working day, it will
049     * be moved according to the algorithm implemented.
050     *
051     * @param calculator
052     *            the calculator
053     * @return the date which may have moved.
054     */
055    E moveCurrentDate(BaseCalculator<E> calculator);
056
057    /**
058     * For a given date, adjust it if required but using the logic across Month/etc for calc
059     * @param startDate
060     * @param increment
061     * @param checker
062     * @return
063     */
064    E adjustDate(E startDate, int increment, NonWorkingDayChecker<E> checker);
065
066    /**
067     * Give the type name for this algorithm.
068     *
069     * @return algorithm name.
070     */
071    String getType();
072}
073
074/*
075 * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
076 *
077 * Based in London, we are world leaders in the design and development
078 * of bespoke applications for the securities financing markets.
079 *
080 * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a>
081 *           ___  _     _           _   _          _
082 *          / _ \| |__ (_) ___  ___| |_| |    __ _| |__
083 *         | | | | '_ \| |/ _ \/ __| __| |   / _` | '_ \
084 *         | |_| | |_) | |  __/ (__| |_| |__| (_| | |_) |
085 *          \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
086 *                   |__/
087 *
088 *                     www.ObjectLab.co.uk
089 */