Class DateRange
- java.lang.Object
-
- de.xima.fc.gui.bean.statistics.model.DateRange
-
public class DateRange extends Object
Model for the range between two dates.
-
-
Field Summary
Fields Modifier and Type Field Description LocalDateTimeendLocalDateTimestartChronoUnittickUnit
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ETimeScalecalculateTimeScale()static DateRangedayRange()static DateRangedayRange(LocalDate date)static DateRangefrom(LocalDateTime start, LocalDateTime end, ChronoUnit shiftUnit)static DateRangefrom(org.apache.commons.lang3.tuple.Pair<Date,Date> dates, ZoneId timeZoneId)intinDays()static DateRangemonthRange()static DateRangemonthRange(LocalDate date)DateRangenext()DateRangeprevious()intticks()static DateRangeweekRange()static DateRangeweekRange(LocalDate date)static DateRangeyearRange()static DateRangeyearRange(int year)
-
-
-
Field Detail
-
start
public final LocalDateTime start
-
end
public final LocalDateTime end
-
tickUnit
public final ChronoUnit tickUnit
-
-
Method Detail
-
dayRange
public static DateRange dayRange()
- Returns:
- a new date range instance for the current day
-
dayRange
public static DateRange dayRange(LocalDate date)
- Returns:
- a new date range instance for the day that contains the provided date
-
weekRange
public static DateRange weekRange()
- Returns:
- a new date range instance for the current week
-
weekRange
public static DateRange weekRange(LocalDate date)
- Returns:
- a new date range instance for the week that contains the provided date
-
monthRange
public static DateRange monthRange()
- Returns:
- a new date range instance for the current month
-
monthRange
public static DateRange monthRange(LocalDate date)
- Returns:
- a new date range instance for the month that contains the provided date
-
yearRange
public static DateRange yearRange()
- Returns:
- a new date range instance for the current year
-
yearRange
public static DateRange yearRange(int year)
- Returns:
- a new date range instance for the year that contains the provided date
-
from
public static DateRange from(org.apache.commons.lang3.tuple.Pair<Date,Date> dates, ZoneId timeZoneId)
- Returns:
- a new date range instance, starting and ending with the dates of the provided date pair
-
from
public static DateRange from(LocalDateTime start, LocalDateTime end, ChronoUnit shiftUnit)
- Returns:
- a new date range instance, starting and ending with the provided dates
-
calculateTimeScale
public ETimeScale calculateTimeScale()
- Returns:
- the time scale related to this date range
-
ticks
public int ticks()
- Returns:
- the (
tickUnitdepending) 'ticks' of this date range
-
inDays
public int inDays()
- Returns:
- the number of days between start and end of this date range
- See Also:
ChronoUnit.between(Temporal, Temporal)
-
previous
public DateRange previous()
- Returns:
- the result of shifting this date range backward by one as a new date range instance
-
next
public DateRange next()
- Returns:
- the result of shifting this date range forward by one as a new date range instance
-
-