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: HolidayHandler.java 200 2006-10-10 20:15:58Z benoitx $
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
035import java.util.Set;
036
037/**
038 * A Holiday Calendar not only defines a set of holiday dates but an early and
039 * late boundary for these dates, e.g. putting the holidays for 2006 in a set
040 * with limits of 1 Jan 2006 and 31 Dec 2006 means that 2006 is covered, not
041 * that 31 Dec is a holiday itself.
042 *
043 * @author Benoit Xhenseval
044 * @since 1.1.0
045 *
046 * @param <E>
047 *            a representation of a date, typically JDK: Date, Calendar;
048 *            Joda:LocalDate, YearMonthDay
049 *
050 */
051public interface HolidayCalendar<E> extends ReadOnlyHolidayCalendar<E> {
052    /**
053     * Takes a copy of the holidays and store it in an immutable
054     * set.
055     */
056    HolidayCalendar<E> setHolidays(final Set<E> holidays);
057
058    /**
059     * Sets the earliest date (must be &lt;= first date in holiday set)
060     * @param earlyBoundary
061     */
062    HolidayCalendar<E> setEarlyBoundary(final E earlyBoundary);
063
064    /**
065     * Sets the latest date (must be &lt;= first date in holiday set)
066     * @param lateBoundary
067     */
068    HolidayCalendar<E> setLateBoundary(final E lateBoundary);
069
070    /**
071     * Check if a date is a holiday.
072     * @param date
073     * @return true if the given date is in the holiday set.
074     */
075    boolean isHoliday(final E date);
076}
077
078/*
079 * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
080 *
081 * Based in London, we are world leaders in the design and development of
082 * bespoke applications for the securities financing markets.
083 *
084 * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a>
085 *
086 *           ___  _     _           _   _          _
087 *          / _ \| |__ (_) ___  ___| |_| |    __ _| |__
088 *         | | | | '_ \| |/ _ \/ __| __| |   / _` | '_ \
089 *         | |_| | |_) | |  __/ (__| |_| |__| (_| | |_) |
090 *          \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
091 *                   |__/
092 *
093 *
094 *                      www.ObjectLab.co.uk
095 */