/* * [CommonwealthDay.java] * * Summary: calculate when Commonwealth day occurs. * * Copyright: (c) 1999-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 4.2 2008-12-03 add World AIDS day */ package com.mindprod.holidays; import com.mindprod.common18.BigDate; /** * calculate when Commonwealth day occurs. * * @author Roedy Green, Canadian Mind Products * @version 4.2 2008-12-03 add World AIDS day * @since 1999 */ public final class CommonwealthDay extends HolInfo { /** * @inheritDoc */ public String getAuthority() { return "http://www.pch.gc.ca/ceremonial-symb/english/day_com.html"; } /** * @inheritDoc */ public int getFirstYear( int base ) { return 1976; } /** * @inheritDoc */ public String getName() { return "Commonwealth Day"; } /** * @inheritDoc */ public String getRule() { return "second Monday in March."; } /** * @inheritDoc */ public int when( int year, boolean shift, int base ) { if ( !isYearValid( year, base ) ) { return BigDate.NULL_ORDINAL; } return BigDate.ordinalOfnthXXXDay( 2, BigDate.MONDAY, year, BigDate.MARCH ); } // end when. }