001/* 002 * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit. 003 * 004 * Based in London, we are world leaders in the design and development 005 * of bespoke applications for the securities financing markets. 006 * 007 * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a> 008 * ___ _ _ _ _ _ 009 * / _ \| |__ (_) ___ ___| |_| | __ _| |__ 010 * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \ 011 * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) | 012 * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/ 013 * |__/ 014 * 015 * www.ObjectLab.co.uk 016 * 017 * $Id$ 018 * 019 * Copyright 2006 the original author or authors. 020 * 021 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 022 * use this file except in compliance with the License. You may obtain a copy of 023 * the License at 024 * 025 * http://www.apache.org/licenses/LICENSE-2.0 026 * 027 * Unless required by applicable law or agreed to in writing, software 028 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 029 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 030 * License for the specific language governing permissions and limitations under 031 * the License. 032 */ 033package net.objectlab.kit.datecalc.jdk8; 034 035import java.time.LocalDate; 036 037import net.objectlab.kit.datecalc.common.BaseCalculator; 038import net.objectlab.kit.datecalc.common.HolidayHandlerType; 039 040/** 041 * A backward handler will move the date backward if it falls on a non working 042 * day. 043 * 044 * @author Benoit Xhenseval 045 * 046 */ 047public class LocalDateBackwardHandler extends LocalDateForwardHandler { 048 049 /** 050 * If the current date of the give calculator is a non-working day, it will 051 * be moved according to the algorithm implemented. 052 * 053 * @param calculator 054 * the calculator 055 * @return the date which may have moved. 056 */ 057 @Override 058 public LocalDate moveCurrentDate(final BaseCalculator<LocalDate> calculator) { 059 return adjustDate(calculator.getCurrentBusinessDate(), -1, calculator); 060 } 061 062 // ----------------------------------------------------------------------- 063 // 064 // ObjectLab, world leaders in the design and development of bespoke 065 // applications for the securities financing markets. 066 // www.ObjectLab.co.uk 067 // 068 // ----------------------------------------------------------------------- 069 070 /** 071 * Give the type name for this algorithm. 072 * 073 * @return algorithm name. 074 */ 075 @Override 076 public String getType() { 077 return HolidayHandlerType.BACKWARD; 078 } 079} 080 081/* 082 * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit. 083 * 084 * Based in London, we are world leaders in the design and development 085 * of bespoke applications for the securities financing markets. 086 * 087 * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a> 088 * ___ _ _ _ _ _ 089 * / _ \| |__ (_) ___ ___| |_| | __ _| |__ 090 * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \ 091 * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) | 092 * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/ 093 * |__/ 094 * 095 * www.ObjectLab.co.uk 096 */