1 /* 2 * File: HolidayEnumerator.java 3 * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) 4 * A commercial license is available, see http://www.jaret.de. 5 * 6 * All rights reserved. This program and the accompanying materials 7 * are made available under the terms of the Common Public License v1.0 8 * which accompanies this distribution, and is available at 9 * http://www.eclipse.org/legal/cpl-v10.html 10 */ 11 package de.jaret.util.date.holidayenumerator; 12 13 import java.util.Date; 14 import java.util.List; 15 import java.util.Locale; 16 17 /** 18 * Interface for a class enumerating holidays and other specially named days for a given Locale and additional RegionID. 19 * A special day is a day with a given name but without a meaning to the working world (such as the 24.12. in germany: 20 * it is named "Heiligabend" but it is not a holiday by law). Those can be used for additional information in calendar 21 * tools. 22 * 23 * @author Peter Kliem 24 * @version $Id: HolidayEnumerator.java 293 2007-03-11 17:50:57Z olk $ 25 */ 26 public interface HolidayEnumerator { 27 /** 28 * Check whether a given day denotes a special (named) day. 29 * 30 * @param date The date to be checked 31 * @return true if the date denotes a named day. 32 */ 33 boolean isSpecialDay(Date date); 34 35 /** 36 * Check whether a given day denotes a holiday. 37 * 38 * @param date date to be checked 39 * @return true if the date denotes a holiday 40 */ 41 boolean isHoliday(Date date); 42 43 /** 44 * Retrieve the name of a special day or holiday. 45 * 46 * @param date date for which the name is to be retrieved 47 * @return the name of the day or <code>null</code> if no name is found. 48 */ 49 String getDayName(Date date); 50 51 /** 52 * Retrieve a list of named days for a given year. 53 * 54 * @param year year to be questioned 55 * @param includeSpecialDays if true, special days are includes, otherwise the list will only contain holidays 56 * @return an ordered list of named dates 57 */ 58 List<NamedDate> getNamedDays(int year, boolean includeSpecialDays); 59 60 /** 61 * Retrieve a list of named days for a given year. 62 * 63 * @param year year to be questioned 64 * @param month month to be questioned 65 * @param includeSpecialDays if true, special days are includes, otherwise the list will only contain holidays 66 * @return an ordered list of named dates 67 */ 68 List<NamedDate> getNamedDays(int year, int month, boolean includeSpecialDays); 69 70 /** 71 * Retrieve the Locale of this HolidayEnumerator. 72 * 73 * @return configured Locale 74 */ 75 Locale getLocale(); 76 77 /** 78 * Retrieve the RegionId of this HolidayEnumerator. 79 * 80 * @return the regionid 81 */ 82 String getRegionId(); 83 84 /** 85 * Retrieve the available region identifiers of the holiday enumerator. 86 * 87 * @return the availbale ids or an empty array for no regions 88 */ 89 String[] getAvailableRegionIds(); 90 91 }