/* * [ArmedForcesDay.java] * * Summary: calculate when Armed Forces 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; // com.mindprod.holidays.ArmedForcesDay /** * calculate when Armed Forces day occurs. * * @author Roedy Green, Canadian Mind Products * @version 4.2 2008-12-03 add World AIDS day * @since 1999 */ public final class ArmedForcesDay extends HolInfo { /** * @inheritDoc */ public String getAuthority() { return "http://www.optonline.com/comptons/ceo/07180_Q.html"; } /** * @inheritDoc */ public int getFirstYear( int base ) { switch ( base ) { default: case OBSERVED: return 1936; case PROCLAIMED: return 1950; } } /** * @inheritDoc */ public String getName() { return "Armed Forces Day"; } /** * @inheritDoc */ public String getRule() { return "Third Saturday in May\n" + "Originally Army Day, celebrated on April 6 (1936-49)\n" + "Proclaimed as Armed Forces day in 1950."; } /** * @inheritDoc */ public int when( int year, boolean shift, int base ) { if ( !isYearValid( year, base ) ) { return BigDate.NULL_ORDINAL; } if ( 1936 <= year && year <= 1949 ) { return shiftSatToFriSunToMon( BigDate.toOrdinal( year, 4, 6 ), shift ); } else { return shiftSatToFriSunToMon( BigDate.ordinalOfnthXXXDay( 3 , BigDate.SATURDAY, year, BigDate.MAY ), shift ); } } // end when. }