All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.xdev.vaadin.daterange_picker.business.DateRange Maven / Gradle / Ivy

The newest version!
/*
 * Copyright © 2020 XDEV Software (https://xdev.software)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package software.xdev.vaadin.daterange_picker.business;

import java.time.LocalDate;
import java.time.Period;
import java.util.Optional;

public interface DateRange
{
	/**
	 * Returns the identification key, e.g. DAY, MONTH, etc
	 * @return identification key
	 */
	String getKey();
	
	/**
	 * Returns the {@link Period} to move the date, if any
	 * @return {@link Period} to move the date
	 */
	Optional getOptMovePeriod();
	
	/**
	 * Retunns the default description, e.g. "Day" or "Half year"
	 * @return default description
	 */
	String getDefaultDescription();
	
	/**
	 *  Trys to return the calculated {@link DateRangeResult} for the supplied date
	 * @param date date that is used for calculation
	 * @return calculated {@link DateRangeResult}
	 */
	Optional calcFor(LocalDate date);
	
	/**
	 * Trys to return a moved {@link DateRangeResult}
	 * @param baseDate Date that is used as a base
	 * @param dif Count of moves
	 * @return moved {@link DateRangeResult}
	 */
	Optional moveDateRange(LocalDate baseDate, int dif);
	
	/**
	 * Returns if the {@link DateRange} is movable
* Example: *
    *
  • false for TODAY
  • *
  • true for MONTH
  • *
  • false for FREE
  • *
* @return if the {@link DateRange} is movable */ boolean isMovable(); /** * Returns if the {@link DateRange} is calcable
* Example: *
    *
  • true for TODAY
  • *
  • true for MONTH
  • *
  • false for FREE
  • *
* @return if the {@link DateRange} is calcable */ boolean isCalcable(); /** * Returns if the {@link DateRange} is settable from a date
* Example: *
    *
  • false for TODAY
  • *
  • true for MONTH
  • *
  • true for FREE
  • *
* @return if the {@link DateRange} is settable from a date */ boolean isSettable(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy