Hourly iterations

55 views
Skip to first unread message

Robert

unread,
Feb 23, 2010, 10:40:06 AM2/23/10
to google-rfc-2445
Samuel, all,

I am very much interested in using com.google.ical.iter package for my
rfc2445 dependent java module project.
However, I'd require iterators to be more granular than currently
(daily).

Before committing to this package and eventual contributing to it, can
you please tell me your assessment on how much effort is required for
further iterator granulation, down to minute levels...

While I'm not yet fully immersed into the code, I've seen the comments
at RecurrenceIteratorFactory.java, line 376, which are looking
promising in that aspect.
I'd like to know your thoughts whether there are any conceptual or
architectural obstacles to further granulation implementation, and
also some pointers on which direction to take when eventually
implementing it.

Thanks

Robert

Mike Samuel

unread,
Feb 23, 2010, 12:46:31 PM2/23/10
to google-...@googlegroups.com
To do hourly and minutely iteration, I think you would probably need
to do the following:
(1) Create byHour and byMinute generators, possibly modeled off
http://code.google.com/p/google-rfc-2445/source/browse/trunk/src/com/google/ical/iter/Generators.java#219
(2) Add cases for HOURLY and MINUTELY at
http://code.google.com/p/google-rfc-2445/source/browse/trunk/src/com/google/ical/iter/RecurrenceIteratorFactory.java#225
(3) Thread whatever generators you create through to the instance
generator implementations, and do the optimization in the code that
you pointed to.
(4) Add hourly and minutely loops at
http://code.google.com/p/google-rfc-2445/source/browse/trunk/src/com/google/ical/iter/InstanceGenerators.java#50
(5) Add tests for the above. Searching through RFC 2445 for
"BYHOUR=", "BYMINUTE=", "FREQ=HOURLY", and "FREQ=MINUTELY" should turn
up test cases that were left out of the initial implementation.

cheers,
mike


2010/2/23 Robert <robert...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "google-rfc-2445" group.
> To post to this group, send email to google-...@googlegroups.com.
> To unsubscribe from this group, send email to google-rfc-24...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-rfc-2445?hl=en.
>
>

Robert Simac

unread,
Feb 24, 2010, 10:33:20 AM2/24/10
to google-...@googlegroups.com
Thanks Mike for useful info, I'll keep you posted when (if) I commit to this.

Mike Samuel

unread,
Feb 24, 2010, 1:42:35 PM2/24/10
to google-...@googlegroups.com
Sounds good.

2010/2/24 Robert Simac <robert...@gmail.com>:

Robert Simac

unread,
Feb 27, 2011, 12:03:15 PM2/27/11
to google-...@googlegroups.com
Mike, all,

I've just made the hourly iterations "work", by more or less blindly following Mike's instructions from this thread and copy/paste/changing the existing functions, mostly using monthly iterator generators and downsizing it to hourly. I admit I dont fully understand what I just did, but it seems to "work", at least by couple of initial tests (interval and list iterations). Please do take a quick look into the code changes attached and let me know if/how I am terribly off the course.
I will continue to analyze the code (changes) and try to understand it better and will post the code updates as I go.

Regards,

Robert

hourly.diff

Mike Samuel

unread,
Feb 27, 2011, 4:21:46 PM2/27/11
to google-...@googlegroups.com, Robert Simac
+ int hoursBetween = (builder.day - day) * 24 - (day - 1);
This seems widgy type-wise.
It seems to be subtracting days from hours.
How do you plan on testing this patch?


The comment
+ // don't update year so that the difference calculation
above is
+ // correct when this function is reentered with a
different year
seems a bit out of place.

2011/2/27 Robert Simac <robert...@gmail.com>:

Robert Simac

unread,
Mar 3, 2011, 10:49:07 AM3/3/11
to mikes...@gmail.com, google-...@googlegroups.com
Thanks Mike for prompt review and reply...

As for testing and other improvements, I first have to actually
understand what I did. Nobody was more surprised than me when this
untidy copy/pasted changes produced expected results :).

I just took the code related to Months and down-scaled it, using it's
relation to Year - into Hour's relation to Day... I expected that
exercise will produce nonfunctional code and will gradually force me
into understanding the environment. Unfortunately :) it seems the code
framework was so strong it accommodated even my blind coding.

Now I have to understand entire framework I did the changes in. The
existing code comments and javadoc seems to be most useful and are
helping me a lot.

As for your code comments, please find attached the diff file
containing the fix attempts.

Regards,
Robert

diff.txt

Mike Samuel

unread,
Mar 4, 2011, 11:51:27 AM3/4/11
to Robert Simac, google-...@googlegroups.com
2011/3/3 Robert Simac <robert...@gmail.com>:

> Thanks Mike for prompt review and reply...
>
> As for testing and other improvements, I first have to actually
> understand what I did. Nobody was more surprised than me when this
> untidy copy/pasted changes produced expected results :).

That's always a nice feeling.

> I just took the code related to Months and down-scaled it, using it's
> relation to Year - into Hour's relation to Day... I expected that
> exercise will produce nonfunctional code and will gradually force me
> into understanding the environment. Unfortunately :) it seems the code
> framework was so strong it accommodated even my blind coding.
>
> Now I have to understand entire framework I did the changes in. The
> existing code comments and javadoc seems to be most useful and are
> helping me a lot.
>
> As for your code comments, please find attached the diff file
> containing the fix attempts.

Cool. Let me know when you've got something you're happy with and
I'll apply the patch.

Reply all
Reply to author
Forward
0 new messages