001/*
002 * Copyright (c) 2009 The openGion Project.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013 * either express or implied. See the License for the specific language
014 * governing permissions and limitations under the License.
015 */
016package org.opengion.hayabusa.resource;
017
018import java.util.Calendar;
019
020/**
021 * カレンダデータインターフェースです。
022 *
023 * カレンダデータは、DBまたは標準のカレンダより休日を求めることができます。
024 *
025 * @og.rev 3.6.0.0 (2004/09/17) 新規作成
026 * @og.group リソース管理
027 *
028 * @version  4.0
029 * @author   Kazuhiko Hasegawa
030 * @since    JDK5.0,
031 */
032public interface CalendarData {
033
034        /**
035         * 指定の日付けが、休日かどうかを返します。
036         * 指定の日付けが、キャッシュしているデータの最大と最小の間に
037         * 存在しない場合は、エラーとします。
038         *
039         * @param       day     指定の日付け
040         *
041         * @return      休日:true それ以外:false
042         *
043         */
044        boolean isHoliday( Calendar day ) ;
045
046        /**
047         * 指定の日付けから、範囲の間に、本日を含むかどうかを返します。
048         * 指定の日付けが、キャッシュしているデータの最大と最小の間に
049         * 存在しない場合は、常に false になります。
050         * 判定は、年月日の項目のみで比較し、時分秒は無視します。
051         *
052         * @og.rev 3.7.1.1 (2005/05/31) 新規追加
053         *
054         * @param       day             指定の開始日付け
055         * @param       scope   範囲の日数
056         *
057         * @return      本日:true それ以外:false
058         */
059        boolean isContainedToday( Calendar day,int scope ) ;
060
061        /**
062         * 指定の開始、終了日の期間に、平日(稼働日)が何日あるか求めます。
063         * start と end が、リスト範囲外の場合は、エラーとします。
064         * 開始と終了が同じ日の場合は、1を返します。
065         *
066         * @param       start   開始日付け(稼働日に含めます)
067         * @param       end             終了日付け(稼働日に含めます)
068         *
069         * @return      稼働日数
070         *
071         */
072        int getKadoubisu( Calendar start,Calendar end ) ;
073
074        /**
075         * 指定の開始日に平日のみ期間を加算して求められる日付けを返します。
076         * これは、実稼働日計算に使用します。
077         * 例えば、start=20040810 , span=5 で、休日がなければ、10,11,12,13,14 となり、
078         * 20040815 を返します。
079         * 指定の日付けや、期間加算後の日付けが、キャッシュしているデータの
080         * 最大と最小の間に存在しない場合は、エラーとします。
081         *
082         * @param       start   開始日付け(YYYYMMDD 形式)
083         * @param       span    稼動期間
084         *
085         * @return      開始日から稼動期間を加算した日付け(当日を含む)
086         *
087         */
088        Calendar getAfterDay( Calendar start,int span ) ;
089}