/* * [BlackFriday.java] * * Summary: Calculate when American Black Friday 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: * 1.0 2009-11-23 initial version */ package com.mindprod.holidays; import com.mindprod.common18.BigDate; /** * Calculate when American Black Friday occurs. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2009-11-23 initial version * @since 2009-11-23 */ public final class BlackFriday extends HolInfo { /** * @inheritDoc */ public String getAuthority() { return "http://en.wikipedia.org/wiki/Black_Friday_(shopping)"; } /** * @inheritDoc */ public int getFirstYear( int base ) { return 1960; } /** * @inheritDoc */ public String getName() { return "Black Friday"; } /** * @inheritDoc */ public String getRule() { return "Friday after American Thanksgiving. Start of Christmas shopping spree."; } /** * @inheritDoc */ public int when( int year, boolean shift, int base ) { if ( !isYearValid( year, base ) ) { return BigDate.NULL_ORDINAL; } if ( year < 1960 ) { return BigDate.NULL_ORDINAL; } // day after Thanksgiving Thursday return BigDate.ordinalOfnthXXXDay( 4/* fourth */, BigDate.THURSDAY, year, BigDate.NOV ) + 1; } // end when. }