AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
rollCalendar (Calendar calendar, int comp, int up) yoix.util
 
NOTE: this function is deprecated and will be going away very, very soon. Use the roll builtin of Calendar instead.

Cycle with increasing values, if up is non-zero, or decreasing values, if up is zero, through all possible values for the component of calendar specified by comp. Unlike addCalendar, rollCalendar will not cause other fields to be incremented or decremented. Though other components may be affected to keep the date / time information consistent, one can just keep cycling through all the values of the particular component indicated until the original value repeats at which point the date / time will be back to its original value. The Calendar argument is returned.
 
 Example:   rollCalendar can be used to cycle through all the days of the current week as follows:
import yoix.stdio.*;
import yoix.util.*;

Calendar c;

printf("Calendar is currently:\t\t%s\n", date(c.unixtime));

int start_date = c.date;

rollCalendar(c, Calendar.DATE, true);

do {
    printf("Cycling up by 1 day yields:\t%s\n", date(c.unixtime));
    rollCalendar(c, Calendar.DAY_OF_WEEK, true);
} while(c.date != start_date);
with the result:
Calendar is currently:          Tue Oct 17 23:36:54 EDT 2000
Cycling up by 1 day yields:     Wed Oct 18 23:36:54 EDT 2000
Cycling up by 1 day yields:     Thu Oct 19 23:36:54 EDT 2000
Cycling up by 1 day yields:     Fri Oct 20 23:36:54 EDT 2000
Cycling up by 1 day yields:     Sat Oct 21 23:36:54 EDT 2000
Cycling up by 1 day yields:     Sun Oct 15 23:36:54 EDT 2000
Cycling up by 1 day yields:     Mon Oct 16 23:36:54 EDT 2000
 
 Return:   Calendar
 
 See Also:   addCalendar, Calendar, compareCalendar, date getCalendarLeastMaximum, getCalendarMaximum, getCalendarMinimum, getDateFormat, parseDate, setCalendar

 

Yoix is a registered trademark of AT&T Inc.