public class RangeUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static Range<Date> |
getDatePeriod(Date date,
Period period)
Return Range<Date> by given date and period.
|
static List<Range<Date>> |
getDateRanges(Date from,
Date to,
Period periodGranulation)
Returns Range<Date> list between given date from and date to by
period granulation.
|
static List<Range<Long>> |
getLongRanges(Long from,
Long to,
int step)
Returns Range<Long> list between given from and to by step.The
minimum step is 1.
e.g: [from:0,to:3,step:1] => [[0-0],[1-1],[2-2],[3-3]] [from:0,to:7,step:2] => [[0-1],[2-3],[4-5],[6-7]] [from:0,to:7,step:3] => [[0-2],[3-5],[6-7]] |
public static List<Range<Date>> getDateRanges(Date from, Date to, Period periodGranulation) throws InvalidRangeException
from - the range from.to - the range to.periodGranulation - the range granulation.InvalidRangeExceptionpublic static Range<Date> getDatePeriod(Date date, Period period)
date - the date belong to the range.period - the range granulation.public static List<Range<Long>> getLongRanges(Long from, Long to, int step) throws InvalidRangeException
from - the range from.to - the range to.step - the range granulation.InvalidRangeExceptionCopyright © 2014. All rights reserved.