Implementation of Range and allows easy iteration between Date types.
Provides all power of Iterable features and complements with:
Initializer |
DateRange(Date from, Date to, UnitOfDate step = ...) Parameters:
|
Attributes | |
duration | Source Code shared actual Duration duration Returns the Duration between from and to fields. Example: Given: today().to(tomorrow).duration then duration is 86400000 milliseconds. Given: tomorrow().to(today).duration then duration is -86400000 milliseconds. Refined declaration: duration |
from | Source Code shared actual Date from The first Element returned by the iterator, if any.
This should always produce the same value as
Example: today().to(tomorrow) -> in this case today() is the caller/creator of the range. Refined declaration: from |
hash | Source Code shared actual Integer hash This implementation respect the constraint that if Refined declaration: hash |
period | Source Code shared actual Period period Returns the Period between from and to fields. Example: Given: today().to(tomorrow).duration then duration is 1 day. Given: tomorrow().to(today).duration then duration is -1 day. Refined declaration: period |
step | Source Code shared actual UnitOfDate step Customized way to iterate over each element, it does not interfer in from and to fields, but it does not guarantee that to will be included in iterator. Refined declaration: step |
to | Source Code shared actual Date to The limit of the Range where. Example: Given: today().to(tomorrow) then tomorrow is the to element. Given: tomorrow.to(today()) then today() is the to element. Refined declaration: to |
Inherited Attributes |
Attributes inherited from: Object string |
Attributes inherited from: Iterable<Element,Absent> coalesced, cycled, empty, first, indexed, last, rest, sequence, size, string |
Attributes inherited from: Range<Element,StepBy> |
Methods | |
equals | Source Code shared actual Boolean equals(Object other) Returns true if both: this and other are same type and have equal fields from and to. Refined declaration: equals |
gap | Source Code Returns empty or a new Range:
Given: [A..B] gap [C..D] When: AB < CD [1..2] gap [5..6] = (2,5) [1..2] gap [6..5] = (2,5) [2..1] gap [5..6] = (2,5) [2..1] gap [6..5] = (2,5) Given: [A..B] gap [C..D] When: AB > CD [5..6] gap [1..2] = (2,5) [5..6] gap [2..1] = (2,5) [6..5] gap [1..2] = (2,5) [6..5] gap [2..1] = (2,5) Refined declaration: gap |
iterator | Source Code An iterator for the elements belonging to this container. where each jump is based on actual step of this Range. Refined declaration: iterator |
overlap | Source Code Returns empty or a new Range:
Given: [A..B] overlap [C..D] When: AB < CD [1..6] overlap [3..9] = [3,6] [1..6] overlap [9..3] = [3,6] [6..1] overlap [3..9] = [3,6] [6..1] overlap [9..3] = [3,6] Given: [A..B] overlap [C..D] When: AB > CD [3..9] overlap [1..6] = [3,6] [3..9] overlap [6..1] = [3,6] [9..3] overlap [1..6] = [3,6] [9..3] overlap [6..1] = [3,6] Refined declaration: overlap |
stepBy | Source Code Define how this Range will get next or previous element while iterating. Refined declaration: stepBy |
Inherited Methods |
Methods inherited from: Category contains, containsAny, containsEvery |
Methods inherited from: Iterable<Element,Absent> any, by, chain, collect, count, cycle, defaultNullElements, every, filter, find, findLast, fold, following, iterator, longerThan, map, repeat, select, shorterThan, skipping, skippingWhile, sort, taking, takingWhile |
Methods inherited from: Range<Element,StepBy> |