Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / sun4-solaris / Date / Calendar / Year.pod
CommitLineData
86530b38
AT
1
2=head1 NAME
3
4Date::Calendar::Year - Implements embedded "year" objects for Date::Calendar
5
6=head1 MOTTO
7
8There is more than one way to do it - this is just one of them!
9
10=head1 PREFACE
11
12Note that Date::Calendar::Year (and Date::Calendar) can only deal
13with years lying within the range [1583..2299].
14
15=head1 SYNOPSIS
16
17 use Date::Calendar::Year qw( check_year empty_period );
18 use Date::Calendar::Year qw( :all ); # same as above
19
20 check_year(YEAR|DATE); # dies if year < 1583 or year > 2299
21 empty_period(); # warns about empty interval if $^W is set
22
23 $index = $year->date2index(YEAR,MONTH,DAY|DATE);
24 $date = $year->index2date(INDEX);
25
26 use Date::Calendar::Profiles qw( $Profiles );
27 $year_2000_US_FL = Date::Calendar::Year->new( 2000, $Profiles->{'US-FL'} [,LANG] );
28 $year_2001_DE_NW = Date::Calendar::Year->new( 2001, $Profiles->{'DE-NW'} [,LANG] );
29
30 $year = Date::Calendar::Year->new( 2001, {} );
31 $year->init( 2002, $Profiles->{'DE-SN'} [,LANG] );
32
33 $vector = $year->vec_full(); # vector of full holidays
34 $vector = $year->vec_half(); # vector of half holidays
35 $vector = $year->vec_work(); # NOT a vector of workdays but a workspace!
36 $size = $year->val_days(); # number of days in that year, size of vectors
37 $base = $year->val_base(); # number of days for [year,1,1] since [1,1,1]
38 $number = $year->val_year(); # the year's number itself
39 $number = $year->year(); # alias for val_year()
40
41 @names = $year->labels(YEAR,MONTH,DAY|DATE);
42 @holidays = $year->labels();
43 $holidays = $year->labels();
44
45 @dates = $year->search(PATTERN);
46 $dates = $year->search(PATTERN);
47
48 $days = $year->delta_workdays(YEAR,MONTH1,DAY1|DATE1
49 ,YEAR,MONTH2,DAY2|DATE2
50 ,FLAG1,FLAG2);
51
52 ($date,$rest,$sign) = $year->add_delta_workdays(YEAR,MONTH,DAY|DATE
53 ,DELTA,SIGN);
54
55 $flag = $year->is_full(YEAR,MONTH,DAY|DATE);
56 $flag = $year->is_half(YEAR,MONTH,DAY|DATE);
57 $flag = $year->is_work(YEAR,MONTH,DAY|DATE);
58
59=head1 INTERFACE
60
61Note that whenever a year number, a date, a time or a combined
62date and time are expected as input parameters by one of the
63methods of this class, you can always pass a Date::Calc[::Object]
64date object or an array reference (of an array of appropriate
65length) instead!
66
67See L<Date::Calc::Object(3)> for more details.
68
69So instead of calling a given method like this:
70
71 $object->method1( $year,$month,$day );
72 $object->method2( $year1,$month1,$day1, $year2,$month2,$day2 );
73 $object->method3( $year1, $year2, $year3 );
74
75You can also call it like so:
76
77 $object->method1( $date );
78 $object->method1( [1964,1,3] );
79
80 $object->method2( $year1,$month1,$day1, $date2 );
81 $object->method2( $date1, $year2,$month2,$day2 );
82 $object->method2( $date1, $date2 );
83 $object->method2( $year1,$month1,$day1, [2001,3,17] );
84 $object->method2( [1964,1,3], $year2,$month2,$day2 );
85 $object->method2( [1964,1,3], [2001,3,17] );
86 $object->method2( $date1, [2001,3,17] );
87 $object->method2( [1964,1,3], $date2 );
88
89 $object->method3( $year1, $date2, [2001,3,17] );
90
91And similarly if a time or a combined date and time are expected.
92
93If you substitute an expected year number by an anonymous array
94(this is the recommended way of writing date constants, for
95increased readability of your programs), it must contain three
96values, nevertheless (otherwise the use of an anonymous array
97would be pointless).
98
99Don't confuse year numbers and their substitutes (a date object
100or an array reference) with Date::Calendar::Year objects, which
101are a totally different thing!
102
103But incidentally C<:-)>, you may also pass a Date::Calendar::Year
104object whenever a year number is expected. However, and perhaps
105against your expectations at times, only the year number from
106that object will be used, not the year object itself (the year
107object in question might be using the wrong profile!).
108
109Moreover, whenever a method of this class returns a date, it
110does so by returning a Date::Calc[::Object] date object.
111
112=head1 IMPLEMENTATION
113
114Each Date::Calendar::Year object consists mainly of three bit
115vectors, plus some administrative attributes, all stored in a
116(blessed) hash.
117
118All three bit vectors contain as many bits as there are days
119in the corresponding year, i.e., either 365 or 366.
120
121The first bit vector, called "FULL", contains set bits for
122Saturdays, Sundays and all "full" legal holidays (i.e.,
123days off, on which you usually do not work).
124
125The second bit vector, called "HALF", contains set bits for
126all "half" holidays, i.e., holidays where you get only half
127a day off from work.
128
129The third and last bit vector, called "WORK", is used as a
130workspace, in which various calculations are performed
131throughout this module.
132
133Its name does B<NOT> come from "working days" (as you might
134think), but from "workspace".
135
136It only so happens that it is used to calculate the working
137days sometimes, at some places in this module.
138
139But you are free to use it yourself, for whatever calculation
140you would like to carry out yourself.
141
142The two other bit vectors, "FULL" and "HALF", should never be
143changed, unless you know B<EXACTLY> what you're doing!
144
145=head1 DESCRIPTION
146
147Functions
148
149=over 2
150
151=item *
152
153C<check_year(YEAR);>
154
155This function checks that the given year lies in the permitted
156range [1583..2299]. It returns nothing in case of success, and
157throws an exception ("given year out of range [1583..2299]")
158otherwise.
159
160=item *
161
162C<empty_period();>
163
164This function issues a warning (from the perspective of the
165caller of a Date::* module) that the given range of dates is
166empty ("dates interval is empty"), provided that warnings are
167enabled (i.e., "C<$^W>" is true).
168
169This function is currently used by the method "delta_workdays()"
170in this class, and by its equivalent from the Date::Calendar
171module.
172
173It is called whenever the range of dates of which the difference
174in working days is to be calculated is empty. This can happen for
175instance if you specify two adjacent dates both of which are not
176to be included in the difference.
177
178=back
179
180Methods
181
182=over 2
183
184=item *
185
186C<$index = $year-E<gt>date2index(YEAR,MONTH,DAY|DATE);>
187
188This method converts a given date into the number of the day in
189that year (this is sometimes also referred to as the "julian"
190date), i.e., a number between 0 (for January 1st) and the number
191of days in the given year minus one, i.e., 364 or 365 (for
192December 31st).
193
194You may need this in order to access the bit vectors returned
195by the methods "vec_full()", "vec_half()" and "vec_work()".
196
197Note that there are shorthand methods in this module called
198"is_full()", "is_half()" and "is_work()", which serve to test
199individual bits of the three bit vectors which are a part of
200each Date::Calendar::Year object.
201
202An exception ("given year != object's year") is thrown if the
203year associated with the year object itself and the year from
204the given date do not match.
205
206An exception ("invalid date") is also thrown if the given
207arguments do not constitute a valid date, or ("given year
208out of range [1583..2299]") if the given year lies outside
209of the permitted range.
210
211=item *
212
213C<$date = $year-E<gt>index2date(INDEX);>
214
215This method converts an index (or "julian date") for the
216given year back into a date.
217
218An exception ("invalid index") is thrown if the given index
219is outside of the permitted range for the given year, i.e.,
220C<[0..364]> or C<[0..365]>.
221
222Note that this method returns a Date::Calc B<OBJECT>!
223
224=item *
225
226C<$year_2000_US_FL = Date::Calendar::Year-E<gt>new( 2000, $Profiles-E<gt>{'US-FL'} [,LANG] );>
227
228C<$year_2001_DE_NW = Date::Calendar::Year-E<gt>new( 2001, $Profiles-E<gt>{'DE-NW'} [,LANG] );>
229
230C<$year = Date::Calendar::Year-E<gt>new( 2001, {} );>
231
232This is the constructor method. Call it to create a new
233Date::Calendar::Year object.
234
235The first argument must be a year number in the range
236[1583..2299].
237
238The second argument must be the reference of a hash,
239which usually contains names of holidays and commemorative
240days as keys and strings containing the date or formula
241for each holiday as values.
242
243Reading this hash and initializing the object's internal
244data is performed by an extra method, called "init()",
245which is called internally by the constructor method,
246and which is described immediately below, after this
247method.
248
249In case you call the "init()" method yourself, explicitly,
250after creating the object, you can pass an empty profile
251(e.g., just an empty anonymous hash) to the "new()" method
252in order to improve performance.
253
254The third argument is optional, and must consist of
255the valid name or number of a language as provided by
256the Date::Calc(3) module if given.
257
258This argument determines which language shall be used
259when reading the profile, since the profile may contain
260names of months and weekdays in its formulas in that
261language.
262
263The default is English if none is specified.
264
265=item *
266
267C<$year-E<gt>init( 2002, $Profiles-E<gt>{'DE-SN'} [,LANG] );>
268
269This method is called by the "new()" constructor method,
270internally, and has the same arguments as the latter.
271
272See immediately above for a description of these arguments.
273
274Note that you can also call this method explicitly yourself,
275if needed, and you can of course subclass the Date::Calendar::Year
276class and override the "init()" method with an method of your own.
277
278The holiday scheme or "profile" (i.e., the reference of
279a hash passed as the second argument to this method) must
280obey the following semantics and syntax:
281
282The keys are the names of the holiday or commemorative day
283in question. Keys must be unique (but see further below).
284
285The difference between a holiday and a commemorative day is
286that you (usually) get a day off on a holiday, whereas on a
287purely commemorative day, you don't.
288
289A commemorative day is just a date with a name, nothing more.
290
291The values belonging to these keys can either be the code
292reference of a callback function (see L<Date::Calendar::Profiles(3)>
293for more details and examples), or a string.
294
295All other values cause a fatal error with program abortion.
296
297The strings can specify three types of dates:
298
299 - fixed dates
300 (like New Year, or first of January),
301
302 - dates relative to Easter Sunday
303 (like Ascension = Easter Sunday + 39 days), and
304
305 - the 1st, 2nd, 3rd, 4th or last
306 of a given day of week in a given month
307 (like "the 4th Thursday of November", or Thanksgiving).
308
309All other types of dates must be specified via callback
310functions.
311
312Note that the "last" of a given day of week is written as
313the "5th", because the last is always either the 5th or the
3144th of the given day of week. So the "init()" module first
315calculates the 5th of the requested day of week, and if that
316doesn't exist, takes the 4th instead.
317
318There are also two modifier characters which may prefix the
319string with the date formula, "#" and ":".
320
321The character "#" (mnemonic: it's only a comment) signals
322that the date in question is a purely commemorative day,
323i.e., it will not enter into any date calculations, but
324can be queried with the "labels()" and "search()" methods,
325and appears when printing a calendar, for instance.
326
327The character ":" (mnemonic: divided into two halfs) specifies
328that the date in question is only a "half" holiday, i.e., you
329only get half a day off instead of a full day. Some companies
330have this sort of thing. C<:-)>
331
332The exact syntax for the date formula strings is the following
333(by example):
334
335 - Fixed dates:
336
337 "Christmas" => "24.12", # European format (day, month)
338 "Christmas" => "24.12.",
339
340 "Christmas" => "24Dec",
341 "Christmas" => "24.Dec",
342 "Christmas" => "24Dec.",
343 "Christmas" => "24.Dec.",
344
345 "Christmas" => "24-12",
346 "Christmas" => "24-12-",
347
348 "Christmas" => "24-Dec",
349 "Christmas" => "24-Dec-",
350
351 "Christmas" => "12/25", # American format (month, day)
352 "Christmas" => "Dec25",
353 "Christmas" => "Dec/25",
354
355 - Dates relative to Easter Sunday:
356
357 "Ladies' Carnival" => "-52",
358 "Carnival Monday" => "-48",
359 "Mardi Gras" => "-47",
360 "Ash Wednesday" => "-46",
361 "Palm Sunday" => "-7",
362 "Maundy Thursday" => "-3",
363 "Good Friday" => "-2",
364 "Easter Sunday" => "+0",
365 "Easter Monday" => "+1",
366 "Ascension" => "+39",
367 "Whitsunday" => "+49",
368 "Whitmonday" => "+50",
369 "Corpus Christi" => "+60",
370
371 - The 1st, 2nd, 3rd, 4th or last day of week:
372
373 "Thanksgiving" => "4Thu11",
374 "Thanksgiving" => "4/Thu/Nov",
375 "Columbus Day" => "2/Mon/Oct",
376 "Columbus Day" => "2/Mon/10",
377 "Columbus Day" => "2/1/Oct",
378 "Columbus Day" => "2/1/10",
379 "Memorial Day" => "5/Mon/May", # LAST Monday of May
380
381Remember that each of these date formula strings may
382also be prefixed with either "#" or ":":
383
384 "Christmas" => ":24.12.", # only half a day off
385 "Valentine's Day" => "#Feb/14", # not an official holiday
386
387Note that the name of the month or day of week may have any
388length you like, it just must specify the intended month or
389day of week unambiguously. So "D", "De", "Dec", "Dece",
390"Decem", "Decemb", "Decembe" and "December" would all
391be valid, for example. Note also that case is ignored.
392
393When specifying day and month numbers, or offsets relative
394to Easter Sunday, leading zeros are permitted (for nicely
395indented formatting, for instance) but ignored.
396
397Leading zeros are not permitted in front of the ordinal
398number [1..5] or the number of the day of week [1..7]
399when specifying the nth day of week in a month.
400
401B<BEWARE> that if keys are not unique in the source code,
402later entries will overwrite previous ones! I.e.,
403
404 ...
405 "My special holiday" => "01-11",
406 "My special holiday" => "02-11",
407 ...
408
409will B<NOT> set two holidays of the same name, one on November
410first, the other on November second, but only one, on November
411second!
412
413Therefore, in order to use sets of defaults and to be able
414to override some of them, you must B<FIRST> include any hash
415containing the default definitions, and B<THEN> write down
416your own definitions (see also the Date::Calendar::Profiles
417module for examples of this!), like this:
418
419 $defaults =
420 {
421 "Holiday #1" => "01-01",
422 "Holiday #2" => "02-02",
423 "Holiday #3" => "03-03"
424 };
425
426 $variant1 =
427 {
428 %$defaults,
429 "Holiday #2" => "09-02",
430 "Holiday #4" => "04-04"
431 };
432
433This is because of the way hashes work in Perl.
434
435The "init()" method proceeds as follows:
436
437First it checks whether the given year number lies in
438the range [1583..2299]. A fatal error occurs if not.
439
440Then it determines the number of days in the requested
441year, and stores it in the given Date::Calendar::Year
442object.
443
444It then calls the Bit::Vector(3) module to allocate three
445bit vectors with a number of bits equal to the number of
446days in the requested year, and stores the three object
447references (of the bit vectors) in the Date::Calendar::Year
448object.
449
450(See also the description of the three methods "vec_full()",
451"vec_half()" and "vec_full()" immediately below.)
452
453It then sets the bits which correspond to Saturdays and
454Sundays in the "full holidays" bit vector.
455
456At last, it iterates over the keys of the given holiday
457scheme (of the hash referred to by the hash reference
458passed to the "init()" method as the second argument),
459evaluates the formula (or calls the given callback
460function), and sets the corresponding bit in the "full"
461or "half" holidays bit vector if the calculated date
462is valid.
463
464A fatal error occurs if the date formula cannot be parsed
465or if the date returned by a formula or callback function
466is invalid (e.g. 30-Feb-2001 or the like) or lies outside
467the given year (e.g. Easter+365).
468
469Finally, the "init()" method makes sure that days marked
470as "full" holidays do not appear as "half" holidays as
471well.
472
473Then the "init()" method returns.
474
475Note that when deciphering the date formulas, the "init()"
476method uses the functions "Decode_Day_of_Week()" and
477"Decode_Month()" from the Date::Calc(3) module, which
478are language-dependent.
479
480Therefore the "init()" method allows you to pass it an optional
481third argument, which must consist of the valid name or number
482of a language as provided by the Date::Calc(3) module.
483
484For the time of scanning the given holiday scheme, the "init()"
485method will temporarily set the language to the value specified,
486and it will restore the original value before returning.
487
488The default is English if none is specified.
489
490This means that you can provide the names of months and days of
491week in your holiday profile in any of the languages supported
492by the Date::Calc(3) module, provided you give the "init()"
493method a clue (the third parameter) which language to expect.
494
495=item *
496
497C<$vector = $year-E<gt>vec_full();>
498
499This method returns a reference to the bit vector in the
500given year object which contains all "full" holidays.
501
502B<BEWARE> that you should B<NEVER> change the contents of this
503bit vector unless you know B<EXACTLY> what you're doing!
504
505You should usually only read from this bit vector, or use it
506as an operand in bit vector operations - but never as an
507lvalue.
508
509=item *
510
511C<$vector = $year-E<gt>vec_half();>
512
513This method returns a reference to the bit vector in the
514given year object which contains all "half" holidays.
515
516B<BEWARE> that you should B<NEVER> change the contents of this
517bit vector unless you know B<EXACTLY> what you're doing!
518
519You should usually only read from this bit vector, or use it
520as an operand in bit vector operations - but never as an
521lvalue.
522
523=item *
524
525C<$vector = $year-E<gt>vec_work();>
526
527This method returns a reference to the "workspace" bit vector
528in the given year object.
529
530Note that you cannot rely on the contents of this bit vector.
531
532You have to set it up yourself before performing any calculations
533with it.
534
535Currently the contents of this bit vector are modified by the
536two methods "delta_workdays()" and "add_delta_workdays()", in
537ways which are hard to predict.
538
539The size of this bit vector can be determined through either
540"C<$days = $vector-E<gt>Size();>" or
541"C<$days = $year-E<gt>val_days();>".
542
543=item *
544
545C<$size = $year-E<gt>val_days();>
546
547This method returns the number of days in the given year object,
548i.e., either 365 or 366. This is also the size (number of bits)
549of the three bit vectors contained in the given year object.
550
551=item *
552
553C<$base = $year-E<gt>val_base();>
554
555This method returns the value of the expression
556"C<Date_to_Days($year-E<gt>val_year(),1,1)>", or in other words,
557the number of days between January 1st of the year 1 and January
5581st of the given year, plus one.
559
560This value is used internally by the method "date2index()" in order
561to calculate the "julian" date or day of the year for a given date.
562
563The expression above is computed only once in method "init()" and
564then stored in one of the year object's attributes, of which this
565method just returns the value.
566
567=item *
568
569C<$number = $year-E<gt>val_year();>
570
571C<$number = $year-E<gt>year();>
572
573These two methods are identical, the latter being a shortcut of
574the former.
575
576They return the number of the year for which a calendar has been
577stored in the given year object.
578
579The method name "val_year()" is used here in order to be consistent
580with the other attribute accessor methods of this class, and the
581method "year()" is necessary in order to be able to pass
582Date::Calendar::Year objects as parameters instead of a year number
583in the methods of the Date::Calendar and Date::Calendar::Year
584modules.
585
586=item *
587
588C<@names = $year-E<gt>labels(YEAR,MONTH,DAY|DATE);>
589
590C<@holidays = $year-E<gt>labels();>
591
592C<$holidays = $year-E<gt>labels();>
593
594If any arguments are given, they are supposed to represent a
595date. In that case, a list of all labels (= names of holidays)
596associated with that date are returned. The first item returned
597is always the name of the day of week for that date.
598
599If no arguments are given, the list of all available labels in
600the given year is returned. This list does B<NOT> include any
601names of the days of week (which would be pointless in this case).
602
603In list context, the resulting list itself is returned. In scalar
604context, the number of items in the resulting list is returned.
605
606=item *
607
608C<@dates = $year-E<gt>search(PATTERN);>
609
610C<$dates = $year-E<gt>search(PATTERN);>
611
612This method searches through all the labels of the given year
613and returns a list of date objects with all dates whose labels
614match the given pattern.
615
616Note that this is a simple, case-insensitive substring search,
617B<NOT> a full-fledged regular expression search!
618
619The result is guaranteed to be sorted chronologically.
620
621In scalar context, only the number of items in the resulting list
622is returned, instead of the resulting list itself (as in list context).
623
624=item *
625
626C<$days = $year-E<gt>delta_workdays(YEAR,MONTH1,DAY1, YEAR,MONTH2,DAY2, FLAG1,FLAG2);>
627
628C<$days = $year-E<gt>delta_workdays(DATE1,DATE2,FLAG1,FLAG2);>
629
630This method calculates the number of work days (i.e., the number
631of days, but excluding all holidays) between two dates.
632
633In other words, this method is equivalent to the "Delta_Days()"
634function of the Date::Calc module, except that it disregards
635holidays in its counting.
636
637The two flags indicate whether the start and end dates should be
638included in the counting (that is, of course, only in case they
639aren't holidays), or not.
640
641It is common, for example, that you want to know how many work
642days are left between the current date and a given deadline.
643
644Typically, you will want to count the current date but not the
645deadline's date. So you would specify "true" ("1") for FLAG1
646and "false" ("0") for FLAG2 in order to achieve that.
647
648In other words, a value of "true" means "including this date",
649a value of "false" means "excluding this date".
650
651As with the "Delta_Days()" function from the Date::Calc module,
652the dates have to be given in chronological order to yield a
653positive result. If the dates are reversed, the result will
654be negative.
655
656The parameter FLAG1 is associated with the first given date,
657the parameter FLAG2 with the second given date (regardless
658of whether the dates are in chronological order or not).
659
660An exception ("given year != object's year") is thrown if the
661year number of either of the two given dates does not match the
662year number associated with the given year object.
663
664An exception ("invalid date") is also raised if either of the
665two date arguments does not constitute a valid date.
666
667=item *
668
669C<($date,$rest,$sign) = $year-E<gt>add_delta_workdays(YEAR,MONTH,DAY, DELTA, SIGN);>
670
671C<($date,$rest,$sign) = $year-E<gt>add_delta_workdays(DATE,DELTA,SIGN);>
672
673This method is the equivalent of the "Add_Delta_Days()" function
674from the Date::Calc module, except that it adds work days and
675skips holidays.
676
677In other words, you can add or subtract a number of work days
678"DELTA" to/from a given date and get a new date as the result
679(as a Date::Calc object).
680
681You add days (i.e., you go forward in time) with a positive
682offset "DELTA", and you subtract days (i.e., you go backwards
683in time) with a negative offset.
684
685Note that an exception ("invalid date") is raised if the
686given date argument (the "start" date) does not constitute
687a valid date.
688
689Beware that this method is limited to date calculations within
690a single year (in contrast to the method with the same name
691from the Date::Calendar module).
692
693Therefore, the method does not only return a date (object),
694but also a "rest" and a "sign".
695
696The "rest" indicates how many days are still left from your
697original DELTA after going in the desired direction and
698reaching a year boundary.
699
700The "sign" indicates in which direction (future or past) one
701needs to go in order to "eat up" the "rest" (by subtracting
702a day from the "rest" for each work day passed), or to adjust
703the resulting date (in order to skip any holidays directly
704after a year boundary), if at all.
705
706The "sign" is -1 for going backwards in time, +1 for going
707forward, and 0 if the result doesn't need any more fixing
708(for instance because the result lies in the same year as
709the starting date).
710
711The method "add_delta_workdays()" from the Date::Calendar
712module uses the "rest" and "sign" return values from this
713method in order to perform calculations which may cross
714year boundaries.
715
716Therefore, it is not recommended to use this method here
717directly, as it is rather clumsy to use, but to use the
718method with the same name from the Date::Calendar module
719instead, which does the same but is much easier to use
720and moreover allows calculations which cross an arbitrary
721number of year boundaries.
722
723=item *
724
725C<$flag = $year-E<gt>is_full(YEAR,MONTH,DAY|DATE);>
726
727This method returns "true" ("1") if the bit corresponding to
728the given date is set in the bit vector representing "full"
729holidays, and "false" ("0") otherwise.
730
731I.e., the method returns "true" if the given date is a (full)
732holiday (according to the calendar profile associated with the
733given year object).
734
735=item *
736
737C<$flag = $year-E<gt>is_half(YEAR,MONTH,DAY|DATE);>
738
739This method returns "true" ("1") if the bit corresponding to
740the given date is set in the bit vector representing "half"
741holidays, and "false" ("0") otherwise.
742
743I.e., the method returns "true" if the given date is a half
744holiday (according to the calendar profile associated with the
745given year object).
746
747Note that if a date is a "full" holiday, the "half" bit is
748never set, even if you try to do so in your calendar profile,
749on purpose or by accident.
750
751=item *
752
753C<$flag = $year-E<gt>is_work(YEAR,MONTH,DAY|DATE);>
754
755This method returns "true" ("1") if the bit corresponding to
756the given date is set in the bit vector used to perform all
757sorts of calculations, and "false" ("0") otherwise.
758
759B<BEWARE> that the "work" in this method's name does B<NOT>
760come from "work days"!
761
762It comes from the fact that the corresponding bit vector can
763be used for any "work" that you need to do. In other words,
764it's a "work space".
765
766Therefore, this bit vector might contain about everything you
767could imagine - including a bit pattern which marks all "work
768days" with set bits, if it so happens!
769
770But you better don't rely on it, unless you put the bit pattern
771there yourself in the first place.
772
773Note that you can get a reference to this bit vector (in order
774to fill it with any bit pattern you like) using the method
775"vec_work()", described further above in this document.
776
777The number of bits in this bit vector is the same as the number
778of days in the given year "C<$year>", which you can retrieve
779through either "C<$days = $year-E<gt>vec_work-E<gt>Size();>"
780or "C<$days = $year-E<gt>val_days();>".
781
782See also L<Bit::Vector(3)> for more details.
783
784=back
785
786=head1 SEE ALSO
787
788Bit::Vector(3), Date::Calendar(3), Date::Calendar::Profiles(3),
789Date::Calc::Object(3), Date::Calc(3).
790
791=head1 VERSION
792
793This man page documents "Date::Calendar::Year" version 5.3.
794
795=head1 AUTHOR
796
797 Steffen Beyer
798 mailto:sb@engelschall.com
799 http://www.engelschall.com/u/sb/download/
800
801=head1 COPYRIGHT
802
803Copyright (c) 2000 - 2002 by Steffen Beyer. All rights reserved.
804
805=head1 LICENSE
806
807This package is free software; you can redistribute it and/or
808modify it under the same terms as Perl itself, i.e., under the
809terms of the "Artistic License" or the "GNU General Public License".
810
811Please refer to the files "Artistic.txt" and "GNU_GPL.txt"
812in this distribution for details!
813
814=head1 DISCLAIMER
815
816This package is distributed in the hope that it will be useful,
817but WITHOUT ANY WARRANTY; without even the implied warranty of
818MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
819
820See the "GNU General Public License" for more details.
821