public class DateSequence extends BaseFieldGenerator<Date>
| Constructor and Description |
|---|
DateSequence(org.joda.time.DateTime start,
org.joda.time.DateTime stop)
Build a sequence that will return values between
start and end (inclusive) with an increment of
1 day. |
DateSequence(org.joda.time.DateTime start,
org.joda.time.DateTime stop,
org.joda.time.ReadableDuration duration)
Build a sequence that will return values between
start and end (inclusive) with an increment of
increment. |
DateSequence(org.joda.time.DateTime start,
org.joda.time.DateTime stop,
org.joda.time.ReadablePeriod period)
Build a sequence that will return values between
start and end (inclusive) with an increment of
increment. |
| Modifier and Type | Method and Description |
|---|---|
Date |
current()
Returns the current sequence value.
|
boolean |
hasNext()
Returns
true if the generator has more value to generate (In other words, returns true if
next would return a value rather than throwing an exception.) |
Date |
next()
Returns the next generated value.
|
void |
reset()
Resets the
DateSequence. |
String |
toString() |
removepublic DateSequence(org.joda.time.DateTime start,
org.joda.time.DateTime stop)
start and end (inclusive) with an increment of
1 day.start - first value in sequence, inclusive.stop - last element in sequence, inclusive.DateSequence(org.joda.time.DateTime, org.joda.time.DateTime, org.joda.time.ReadablePeriod)public DateSequence(org.joda.time.DateTime start,
org.joda.time.DateTime stop,
org.joda.time.ReadableDuration duration)
start and end (inclusive) with an increment of
increment. For instance, in:
s1 = new DateSequence(
new DateTime(1, 1, 1, 0, 0, 0),
new DateTime(1, 1, 3, 0, 0, 0),
new Duration(24 * 60 * 60 * 1000)
);
s1 = new DateSequence(
new DateTime(1, 1, 1, 0, 0, 0),
new DateTime(1, 1, 5, 0, 0, 0),
new Duration(2 * 24 * 60 * 60 * 1000)
);
s1 will generate the following dates: 1-1-1T0:0:0, 1-1-2T0:0:0, 1-1-3T0:0:0 and
s2 will generate 1-1-1T0:0:0, 1-1-3T0:0:0, 1-1-5T0:0:0.start - first value in sequence, inclusive.stop - last element in sequence, inclusive.duration - increment.IllegalArgumentException - if start is less than stop or if increment is less than or equal to
0ms.public DateSequence(org.joda.time.DateTime start,
org.joda.time.DateTime stop,
org.joda.time.ReadablePeriod period)
start and end (inclusive) with an increment of
increment. For instance, in:
s1 = new DateSequence(
new DateTime(1, 1, 1, 0, 0, 0),
new DateTime(1, 1, 3, 0, 0, 0),
new Period.days(1)
);
s1 = new DateSequence(
new DateTime(1, 1, 1, 0, 0, 0),
new DateTime(1, 1, 5, 0, 0, 0),
new Period.days(1)
);
s1 will generate the following dates: 1-1-1T0:0:0, 1-1-2T0:0:0, 1-1-3T0:0:0 and
s2 will generate 1-1-1T0:0:0, 1-1-3T0:0:0, 1-1-5T0:0:0.start - first value in sequence, inclusive.stop - last element in sequence, inclusive.period - increment.IllegalArgumentException - if start is less than stop or if increment is less than or equal to
0ms.public void reset()
public Date current()
next if next was never called before since
creation of last reset().public boolean hasNext()
true if the generator has more value to generate (In other words, returns true if
next would return a value rather than throwing an exception.)true if the iteration has more value.public Date next()
NoSuchElementException - if the iteration has no more value.Copyright © 2014. All Rights Reserved.