2 Copyright (C) 2004 Marcus Mueller
4 This file is part of OpenGroupware.org.
6 OGo 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 OGo 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 OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #ifndef __NGExtensions_NGCalendarDateRange_H_
24 #define __NGExtensions_NGCalendarDateRange_H_
26 #import <Foundation/NSObject.h>
27 #import <Foundation/NSArray.h>
29 @class NSString, NSCalendarDate;
31 @interface NGCalendarDateRange : NSObject <NSCopying>
33 NSCalendarDate *startDate;
34 NSCalendarDate *endDate;
37 + (id)calendarDateRangeWithStartDate:(NSCalendarDate *)_start
38 endDate:(NSCalendarDate *)_end;
39 - (id)initWithStartDate:(NSCalendarDate *)_start
40 endDate:(NSCalendarDate *)_end;
44 - (NSCalendarDate *)startDate;
45 - (NSCalendarDate *)endDate;
49 - (NSComparisonResult)compare:(NGCalendarDateRange *)other;
53 - (NGCalendarDateRange *)intersectionDateRange:(NGCalendarDateRange *)other;
54 - (NGCalendarDateRange *)unionDateRange:(NGCalendarDateRange *)other;
56 - (BOOL)doesIntersectWithDateRange:(NGCalendarDateRange *)_other;
58 - (BOOL)containsDate:(NSCalendarDate *)date;
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_ */