2 Copyright (C) 2004 Marcus Mueller
4 This file is part of SOPE.
6 SOPE is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __NGExtensions_NGCalendarDateRange_H_
23 #define __NGExtensions_NGCalendarDateRange_H_
25 #import <Foundation/NSObject.h>
26 #import <Foundation/NSArray.h>
28 @class NSString, NSCalendarDate;
30 @interface NGCalendarDateRange : NSObject <NSCopying>
32 NSCalendarDate *startDate;
33 NSCalendarDate *endDate;
36 + (id)calendarDateRangeWithStartDate:(NSCalendarDate *)_start
37 endDate:(NSCalendarDate *)_end;
38 - (id)initWithStartDate:(NSCalendarDate *)_start
39 endDate:(NSCalendarDate *)_end;
43 - (NSCalendarDate *)startDate;
44 - (NSCalendarDate *)endDate;
48 - (NSComparisonResult)compare:(NGCalendarDateRange *)other;
52 - (NGCalendarDateRange *)intersectionDateRange:(NGCalendarDateRange *)other;
53 - (NGCalendarDateRange *)unionDateRange:(NGCalendarDateRange *)other;
55 - (BOOL)doesIntersectWithDateRange:(NGCalendarDateRange *)_other;
57 - (BOOL)containsDate:(NSCalendarDate *)date;
58 - (BOOL)containsDateRange:(NGCalendarDateRange *)_range;
62 @interface NSArray(NGCalendarDateRanges)
64 - (NSArray *)arrayByCreatingDateRangesFromObjectsWithStartDateKey:(NSString *)s
65 andEndDateKey:(NSString *)e;
67 - (unsigned)indexOfFirstIntersectingDateRange:(NGCalendarDateRange *)_range;
68 - (BOOL)dateRangeArrayContainsDate:(NSCalendarDate *)_date;
70 - (NSArray *)arrayByCompactingContainedDateRanges;
74 #endif /* __NGExtensions_NGCalendarDateRange_H_ */