├── Backlog Notes ├── iOS Notes │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── Default.png │ ├── Default@2x.png │ ├── Default-568h@2x.png │ ├── main.m │ ├── Backlog Notes-Prefix.pch │ └── Backlog Notes-Info.plist ├── Classes │ ├── iOS_Constants.m │ ├── thirdparty │ │ ├── CHDataStructures │ │ │ ├── libCHDataStructures.a │ │ │ └── include │ │ │ │ ├── CHDataStructures_Prefix.pch │ │ │ │ ├── CHCircularBufferDeque.h │ │ │ │ ├── CHCircularBufferQueue.h │ │ │ │ ├── CHCircularBufferStack.h │ │ │ │ ├── CHBinaryHeap.h │ │ │ │ ├── CHListStack.h │ │ │ │ ├── CHListDeque.h │ │ │ │ ├── CHListQueue.h │ │ │ │ ├── CHUnbalancedTree.h │ │ │ │ ├── CHMutableSet.h │ │ │ │ ├── CHMutableDictionary.h │ │ │ │ ├── CHMutableArrayHeap.h │ │ │ │ ├── CHAbstractListCollection.h │ │ │ │ ├── CHCircularBuffer.h │ │ │ │ ├── CHRedBlackTree.h │ │ │ │ ├── CHAVLTree.h │ │ │ │ ├── CHSortedDictionary.h │ │ │ │ ├── CHSinglyLinkedList.h │ │ │ │ ├── CHAnderssonTree.h │ │ │ │ ├── CHDoublyLinkedList.h │ │ │ │ ├── CHAbstractBinarySearchTree_Internal.h │ │ │ │ ├── CHAbstractBinarySearchTree.h │ │ │ │ ├── CHTreap.h │ │ │ │ ├── CHMultiDictionary.h │ │ │ │ ├── CHSearchTree.h │ │ │ │ ├── CHBidirectionalDictionary.h │ │ │ │ ├── CHHeap.h │ │ │ │ ├── CHDataStructures.h │ │ │ │ ├── CHOrderedSet.h │ │ │ │ ├── Util.h │ │ │ │ ├── CHStack.h │ │ │ │ └── CHQueue.h │ │ └── DALinedTextView │ │ │ ├── DALinedTextView.h │ │ │ └── DALinedTextView.m │ ├── AppDelegate.h │ ├── DataModel.h │ ├── ChecklistItem.h │ ├── NotesViewController.h │ ├── iOS_Constants.h │ ├── DataModel.m │ ├── AddNoteViewController.h │ ├── ChecklistItem.m │ ├── AppDelegate.m │ └── AddNoteViewController.m ├── Resource FIles │ ├── UI │ │ ├── category.png │ │ ├── category@2x.png │ │ ├── ipad-arrow.png │ │ ├── ipad-arrow@2x.png │ │ ├── blue-background.png │ │ └── blue-background@2x.png │ └── Graphics Files │ │ └── icons │ │ ├── Icon.png │ │ ├── Icon-60.png │ │ ├── Icon@2x.png │ │ ├── Icon-60@2x.png │ │ ├── Icon-Small.png │ │ ├── Icon-Small-40.png │ │ ├── Icon-Small@2x.png │ │ ├── iTunesArtwork.png │ │ ├── Icon-Small-40@2x.png │ │ └── iTunesArtwork@2x.png └── Backlog Notes.xcodeproj │ ├── xcuserdata │ ├── Kalai.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints.xcbkptlist │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── iOS Notes.xcscheme │ ├── partho.xcuserdatad │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── iOS Notes.xcscheme │ └── parthobiswas.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── Backlog Notes.xcscheme │ └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ ├── Kalai.xcuserdatad │ ├── UserInterfaceState.xcuserstate │ └── WorkspaceSettings.xcsettings │ ├── partho.xcuserdatad │ ├── UserInterfaceState.xcuserstate │ └── WorkspaceSettings.xcsettings │ └── parthobiswas.xcuserdatad │ └── UserInterfaceState.xcuserstate └── README.md /Backlog Notes/iOS Notes/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/iOS_Constants.m: -------------------------------------------------------------------------------- 1 | 2 | #import "iOS_Constants.h" 3 | 4 | @implementation iOS_Constants 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /Backlog Notes/iOS Notes/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/iOS Notes/Default.png -------------------------------------------------------------------------------- /Backlog Notes/iOS Notes/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/iOS Notes/Default@2x.png -------------------------------------------------------------------------------- /Backlog Notes/iOS Notes/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/iOS Notes/Default-568h@2x.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/UI/category.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/UI/category.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/UI/category@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/UI/category@2x.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/UI/ipad-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/UI/ipad-arrow.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/UI/ipad-arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/UI/ipad-arrow@2x.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/UI/blue-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/UI/blue-background.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/UI/blue-background@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/UI/blue-background@2x.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/Graphics Files/icons/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/Graphics Files/icons/Icon.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/Graphics Files/icons/Icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/Graphics Files/icons/Icon-60.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/Graphics Files/icons/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/Graphics Files/icons/Icon@2x.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/Graphics Files/icons/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/Graphics Files/icons/Icon-60@2x.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/Graphics Files/icons/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/Graphics Files/icons/Icon-Small.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/Graphics Files/icons/Icon-Small-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/Graphics Files/icons/Icon-Small-40.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/Graphics Files/icons/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/Graphics Files/icons/Icon-Small@2x.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/Graphics Files/icons/iTunesArtwork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/Graphics Files/icons/iTunesArtwork.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/Graphics Files/icons/Icon-Small-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/Graphics Files/icons/Icon-Small-40@2x.png -------------------------------------------------------------------------------- /Backlog Notes/Resource FIles/Graphics Files/icons/iTunesArtwork@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Resource FIles/Graphics Files/icons/iTunesArtwork@2x.png -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/libCHDataStructures.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Classes/thirdparty/CHDataStructures/libCHDataStructures.a -------------------------------------------------------------------------------- /Backlog Notes/Backlog Notes.xcodeproj/xcuserdata/Kalai.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Backlog Notes/Backlog Notes.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Backlog Notes/Backlog Notes.xcodeproj/project.xcworkspace/xcuserdata/Kalai.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Backlog Notes.xcodeproj/project.xcworkspace/xcuserdata/Kalai.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Backlog Notes/Backlog Notes.xcodeproj/project.xcworkspace/xcuserdata/partho.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Backlog Notes.xcodeproj/project.xcworkspace/xcuserdata/partho.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Backlog Notes/iOS Notes/main.m: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | #import "AppDelegate.h" 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | @autoreleasepool { 9 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import "iOS_Constants.h" 4 | 5 | @interface AppDelegate : UIResponder 6 | 7 | @property (strong, nonatomic) UIWindow *window; 8 | 9 | 10 | -(void)customizeAppearance; 11 | 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/DataModel.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import 4 | 5 | @interface DataModel : NSObject 6 | 7 | 8 | 9 | /// We declare nextChecklistItemId method to assign an ID for each notification scheduled. 10 | 11 | + (int)nextChecklistItemId; 12 | 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Backlog Notes/Backlog Notes.xcodeproj/project.xcworkspace/xcuserdata/parthobiswas.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/partho-maple/Backlog-Notes/HEAD/Backlog Notes/Backlog Notes.xcodeproj/project.xcworkspace/xcuserdata/parthobiswas.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/DALinedTextView/DALinedTextView.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface DALinedTextView : UITextView 5 | 6 | @property (nonatomic, strong) UIColor *horizontalLineColor UI_APPEARANCE_SELECTOR; 7 | @property (nonatomic, strong) UIColor *verticalLineColor UI_APPEARANCE_SELECTOR; 8 | 9 | @property (nonatomic) UIEdgeInsets margins UI_APPEARANCE_SELECTOR; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /Backlog Notes/iOS Notes/Backlog Notes-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'iOS Notes' target in the 'iOS Notes' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Backlog Notes/Backlog Notes.xcodeproj/project.xcworkspace/xcuserdata/Kalai.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Backlog Notes/Backlog Notes.xcodeproj/project.xcworkspace/xcuserdata/partho.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/ChecklistItem.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import "DataModel.h" 4 | 5 | 6 | @interface ChecklistItem : NSObject 7 | 8 | ///declare propertis of the items we want to store 9 | 10 | @property (nonatomic, copy) NSString *notes; 11 | 12 | 13 | @property (nonatomic, copy) NSDate *dueDate; 14 | @property (nonatomic, assign) BOOL shouldRemind; 15 | @property (nonatomic, assign) int itemId; 16 | 17 | 18 | 19 | ///declare method to schedule local notification 20 | - (void)scheduleNotification; 21 | 22 | 23 | 24 | 25 | 26 | @end -------------------------------------------------------------------------------- /Backlog Notes/Backlog Notes.xcodeproj/xcuserdata/Kalai.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | iOS Notes.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | A66B8C3217A3BD1100E95A07 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Backlog Notes/Backlog Notes.xcodeproj/xcuserdata/partho.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | iOS Notes.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | A66B8C3217A3BD1100E95A07 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Backlog Notes/Backlog Notes.xcodeproj/xcuserdata/parthobiswas.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Backlog Notes.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | A66B8C3217A3BD1100E95A07 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/NotesViewController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import "AddNoteViewController.h" 4 | #import "iOS_Constants.h" 5 | #import "CHOrderedDictionary.h" 6 | 7 | 8 | 9 | @interface NotesViewController : UITableViewController { 10 | 11 | } 12 | 13 | 14 | - (NSString *) documentsDirectory; 15 | - (NSString *) dataFilePath; 16 | - (void) saveChecklistItems; 17 | - (void) loadChecklistItems; 18 | 19 | // Sort the table date on it's date 20 | - (void) sortTableDateToIndecesByDateWith:(NSMutableArray *)listItems; 21 | 22 | - (int) getIndexOf:(NSString*)c Into:(NSString*)string; 23 | + (BOOL) date:(NSDate*)date isBetweenDate:(NSDate*)beginDate andDate:(NSDate*)endDate; 24 | - (void) configureTextForCell:(UITableViewCell *)cell withChecklistItem:(ChecklistItem *)item; 25 | - (void) refresh; 26 | 27 | 28 | -(void)customizeAppearance; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/iOS_Constants.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import 4 | 5 | 6 | 7 | // Global Constants 8 | 9 | #define backgroundColorGradientTop [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:0.4] 10 | 11 | #define backgroundColorGradientBottom [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:0.4] 12 | 13 | #define NavBarBackgroundColor [UIColor colorWithRed:84/255.0 green:60/255.0 blue:48/255.0 alpha:1.0] 14 | 15 | #define TableSectionHeaderBackgroundColorYellow [UIColor colorWithRed:247/255.0 green:244/255.0 blue:180/255.0 alpha:0.8] 16 | #define TableSectionHeaderTextColorYellow [UIColor colorWithRed:249/255.0 green:223/255.0 blue:74/255.0 alpha:1.0] 17 | 18 | 19 | #define TableCellBackgroundColor [UIColor colorWithRed:240/255.0 green:240/255.0 blue:174/255.0 alpha:0.4] 20 | 21 | 22 | 23 | 24 | @interface iOS_Constants : NSObject 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Backlog Notes 2 | 3 | Link: https://itunes.apple.com/us/app/backlog-notes/id850195712?mt=8 4 | 5 | Also has a swift version: https://github.com/partho-maple/Backlog-Notes_Swift 6 | 7 | 8 | # Description 9 | 10 | Backlog notes shows the timeline view of things you want to do. 11 | 12 | Writing down things you want to do is the beginning, getting in done is the goal. Backlog Notes nudges you to attend to the things you want to do. 13 | 14 | Capture everything you think about doing and view them in the timeline you first thought about them. See something you really want to do but has not been done for a month, this should give you the nudge to get it done. See something hanging around for a month and its not done, maybe its time to delete and move on. 15 | 16 | In the app, things are kept simple. 17 | 18 | - You think about something todo, add it. 19 | - Find some more information about the todo, update it. 20 | - Achieved what you set out todo, clear it. 21 | - View the timeline. Notice something not relevant anymore, delete it. 22 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHDataStructures_Prefix.pch: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHDataStructures_Prefix.pch 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | /** 14 | @file CHDataStructures_Prefix.pch 15 | 16 | Prefix header for all source files of the 'CHDataStructures' framework. 17 | */ 18 | 19 | #import 20 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHCircularBufferDeque.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHCircularBufferDeque.h 3 | 4 | Copyright (c) 2009-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHDeque.h" 14 | #import "CHCircularBuffer.h" 15 | 16 | /** 17 | @file CHCircularBufferDeque.h 18 | A simple CHDeque implemented using a CHCircularBuffer. 19 | */ 20 | 21 | /** 22 | A simple CHDeque implemented using a CHCircularBuffer. 23 | */ 24 | @interface CHCircularBufferDeque : CHCircularBuffer 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHCircularBufferQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHCircularBufferQueue.h 3 | 4 | Copyright (c) 2009-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHQueue.h" 14 | #import "CHCircularBuffer.h" 15 | 16 | /** 17 | @file CHCircularBufferQueue.h 18 | A simple CHQueue implemented using a CHCircularBuffer. 19 | */ 20 | 21 | /** 22 | A simple CHQueue implemented using a CHCircularBuffer. 23 | */ 24 | @interface CHCircularBufferQueue : CHCircularBuffer 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHCircularBufferStack.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHCircularBufferStack.h 3 | 4 | Copyright (c) 2009-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHStack.h" 14 | #import "CHCircularBuffer.h" 15 | 16 | /** 17 | @file CHCircularBufferStack.h 18 | A simple CHStack implemented using a CHCircularBuffer. 19 | */ 20 | 21 | /** 22 | A simple CHStack implemented using a CHCircularBuffer. 23 | */ 24 | @interface CHCircularBufferStack : CHCircularBuffer 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHBinaryHeap.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHBinaryHeap.h 3 | 4 | Copyright (c) 2009-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHHeap.h" 14 | 15 | /** 16 | @file CHBinaryHeap.h 17 | A CHHeap implemented using a CFBinaryHeapRef internally. 18 | */ 19 | 20 | /** 21 | A CHHeap implemented using a CFBinaryHeapRef internally. 22 | */ 23 | @interface CHBinaryHeap : NSObject { 24 | __strong CFBinaryHeapRef heap; // Used for storing objects in the heap. 25 | NSComparisonResult sortOrder; // Whether to sort objects ascending or not. 26 | unsigned long mutations; // Used to track mutations for NSFastEnumeration. 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHListStack.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHListStack.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | Copyright (c) 2002, Phillip Morelock 6 | 7 | This source code is released under the ISC License. 8 | 9 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 10 | 11 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 12 | */ 13 | 14 | #import "CHStack.h" 15 | #import "CHAbstractListCollection.h" 16 | 17 | /** 18 | @file CHListStack.h 19 | A simple CHStack implemented using a CHSinglyLinkedList. 20 | */ 21 | 22 | /** 23 | A simple CHStack implemented using a CHSinglyLinkedList. A singly-linked list is a natural choice since objects are only inserted and removed at the top of the stack, which is easily modeled as the head of a linked list. Enumerating from the top of the stack to the bottom also follows the natural ordering of a linked list. 24 | */ 25 | @interface CHListStack : CHAbstractListCollection 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHListDeque.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHListDeque.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHDeque.h" 14 | #import "CHAbstractListCollection.h" 15 | 16 | /** 17 | @file CHListDeque.h 18 | A simple CHDeque implemented using a CHDoublyLinkedList. 19 | */ 20 | 21 | /** 22 | A simple CHDeque implemented using a CHDoublyLinkedList. A doubly-linked list is a natural choice since a deque supports insertion and removal at both ends (removing from the tail is O(n) in a singly-linked list, but O(1) in a doubly-linked list) and enumerating objects from back to front (hopelessly inefficient in a singly-linked list). The trade-offs for these benefits are marginally higher storage cost and marginally slower operations due to handling reverse links. 23 | */ 24 | @interface CHListDeque : CHAbstractListCollection 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHListQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHListQueue.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | Copyright (c) 2002, Phillip Morelock 6 | 7 | This source code is released under the ISC License. 8 | 9 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 10 | 11 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 12 | */ 13 | 14 | #import "CHQueue.h" 15 | #import "CHAbstractListCollection.h" 16 | 17 | /** 18 | @file CHListQueue.h 19 | A simple CHQueue implemented using a CHSinglyLinkedList. 20 | */ 21 | 22 | /** 23 | A simple CHQueue implemented using a CHSinglyLinkedList. A singly-linked list is a natural choice since a queue can only insert at one end (the back) and remove at the other end (the front). Since CHSinglyLinkedList tracks the tail node, both of these operations are O(1). Other queue operations generally only proceed from front to back, so the lack of reverse pointers is not problematic, and each object requires less storage space. 24 | */ 25 | @interface CHListQueue : CHAbstractListCollection 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/DataModel.m: -------------------------------------------------------------------------------- 1 | 2 | #import "DataModel.h" 3 | 4 | 5 | @implementation DataModel 6 | 7 | 8 | 9 | ///register defaults for the application. We declare yes to firsttime and id for location notification to zero. 10 | - (void)registerDefaults 11 | { 12 | NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys: 13 | [NSNumber numberWithBool:YES], @"FirstTime", 14 | [NSNumber numberWithInt:0], @"ChecklistItemId", 15 | nil]; 16 | [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary]; 17 | } 18 | 19 | 20 | 21 | ///When the app run first time, we need to change the user default for "firstrun" to NO. 22 | - (void)handleFirstTime 23 | { 24 | BOOL firstTime = [[NSUserDefaults standardUserDefaults] boolForKey:@"FirstTime"]; 25 | if (firstTime) { 26 | 27 | [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"FirstTime"]; 28 | 29 | } 30 | } 31 | 32 | 33 | 34 | ///Once loaded we call the following methods to check whether first time or subsequent time loading. 35 | - (id)init 36 | { 37 | if ((self = [super init])) { 38 | [self registerDefaults]; 39 | [self handleFirstTime]; 40 | } 41 | return self; 42 | } 43 | 44 | 45 | 46 | ///Here we assign the ID for first checklist createdto 0 and for each checklist generated subsequently will add incremental of 1. 47 | + (int)nextChecklistItemId 48 | { 49 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; 50 | int itemId = [userDefaults integerForKey:@"ChecklistItemId"]; 51 | [userDefaults setInteger:itemId + 1 forKey:@"ChecklistItemId"]; 52 | [userDefaults synchronize]; 53 | return itemId; 54 | } 55 | 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHUnbalancedTree.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHUnbalancedTree.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | Copyright (c) 2002, Phillip Morelock 6 | 7 | This source code is released under the ISC License. 8 | 9 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 10 | 11 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 12 | */ 13 | 14 | #import "CHAbstractBinarySearchTree.h" 15 | 16 | /** 17 | @file CHUnbalancedTree.h 18 | A generic, unbalanced implementation of CHSearchTree. 19 | */ 20 | 21 | /** 22 | A simple unbalanced binary tree that does not guarantee O(log n) access. The algorithms for insertion and removal have been adapted from code in the Binary Search Trees tutorial, which is in the public domain, courtesy of Julienne Walker. Method names have been changed to match the APIs of existing Cocoa collections provided by Apple. 23 | 24 | Even though the tree is not balanced when items are added or removed, access is at worst linear if the tree essentially degenerates into a linked list. This class is fast, and without stack risk because it works without recursion. 25 | */ 26 | @interface CHUnbalancedTree : CHAbstractBinarySearchTree 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHMutableSet.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHMutableSet.h 3 | 4 | Copyright (c) 2009-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "Util.h" 14 | 15 | /** 16 | @file CHMutableSet.h 17 | 18 | A mutable set class. 19 | */ 20 | 21 | /** 22 | A mutable set class. 23 | 24 | A CFMutableSetRef is used internally to store the key-value pairs. Subclasses may choose to add other instance variables to enable a specific ordering of keys, override methods to modify behavior, and add methods to extend existing behaviors. However, all subclasses should behave like a standard Cocoa dictionary as much as possible, and document clearly when they do not. 25 | 26 | @note Any method inherited from NSSet or NSMutableSet is supported by this class and its children. Please see the documentation for those classes for details. 27 | */ 28 | @interface CHMutableSet : NSMutableSet { 29 | __strong CFMutableSetRef set; // A Core Foundation set. 30 | } 31 | 32 | - (id) initWithCapacity:(NSUInteger)numItems; 33 | 34 | - (void) addObject:(id)anObject; 35 | - (id) anyObject; 36 | - (BOOL) containsObject:(id)anObject; 37 | - (NSUInteger) count; 38 | - (id) member:(id)anObject; 39 | - (NSEnumerator*) objectEnumerator; 40 | - (void) removeAllObjects; 41 | - (void) removeObject:(id)anObject; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Backlog Notes/iOS Notes/Backlog Notes-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIcons 12 | 13 | CFBundlePrimaryIcon 14 | 15 | CFBundleIconFiles 16 | 17 | Icon-Small 18 | Icon-Small-40 19 | Icon-60 20 | Icon.png 21 | Icon@2x.png 22 | 23 | 24 | 25 | CFBundleIdentifier 26 | com.PTS.${PRODUCT_NAME:rfc1034identifier} 27 | CFBundleInfoDictionaryVersion 28 | 6.0 29 | CFBundleName 30 | ${PRODUCT_NAME} 31 | CFBundlePackageType 32 | APPL 33 | CFBundleShortVersionString 34 | 1.1 35 | CFBundleSignature 36 | ???? 37 | CFBundleVersion 38 | 1.1 39 | LSRequiresIPhoneOS 40 | 41 | UIMainStoryboardFile 42 | MainStoryboard_iPhone 43 | UIMainStoryboardFile~ipad 44 | MainStoryboard_iPad 45 | UIRequiredDeviceCapabilities 46 | 47 | armv7 48 | 49 | UISupportedInterfaceOrientations 50 | 51 | UIInterfaceOrientationPortrait 52 | UIInterfaceOrientationLandscapeLeft 53 | UIInterfaceOrientationLandscapeRight 54 | 55 | UISupportedInterfaceOrientations~ipad 56 | 57 | UIInterfaceOrientationPortrait 58 | UIInterfaceOrientationPortraitUpsideDown 59 | UIInterfaceOrientationLandscapeLeft 60 | UIInterfaceOrientationLandscapeRight 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHMutableDictionary.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHMutableDictionary.h 3 | 4 | Copyright (c) 2009-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "Util.h" 14 | 15 | HIDDEN void createCollectableCFMutableDictionary(CFMutableDictionaryRef* dictionary, NSUInteger initialCapacity); 16 | 17 | /** 18 | @file CHMutableDictionary.h 19 | 20 | A mutable dictionary class. 21 | */ 22 | 23 | /** 24 | A mutable dictionary class. 25 | 26 | A CFMutableDictionaryRef is used internally to store the key-value pairs. Subclasses may choose to add other instance variables to enable a specific ordering of keys, override methods to modify behavior, and add methods to extend existing behaviors. However, all subclasses should behave like a standard Cocoa dictionary as much as possible, and document clearly when they do not. 27 | 28 | @note Any method inherited from NSDictionary or NSMutableDictionary is supported by this class and its children. Please see the documentation for those classes for details. 29 | 30 | @todo Implement @c -copy and @c -mutableCopy differently (so users can actually obtain an immutable copy) and make mutation methods aware of immutability? 31 | */ 32 | @interface CHMutableDictionary : NSMutableDictionary { 33 | __strong CFMutableDictionaryRef dictionary; // A Core Foundation dictionary. 34 | } 35 | 36 | - (id) initWithCapacity:(NSUInteger)numItems; 37 | 38 | - (NSUInteger) count; 39 | - (NSEnumerator*) keyEnumerator; 40 | - (id) objectForKey:(id)aKey; 41 | - (void) removeAllObjects; 42 | - (void) removeObjectForKey:(id)aKey; 43 | - (void) setObject:(id)anObject forKey:(id)aKey; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHMutableArrayHeap.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHMutableArrayHeap.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHHeap.h" 14 | 15 | /** 16 | @file CHMutableArrayHeap.h 17 | A simple CHHeap implemented as a subclass of NSMutableArray. 18 | */ 19 | 20 | /** 21 | A simple CHHeap implemented as a subclass of NSMutableArray. 22 | */ 23 | @interface CHMutableArrayHeap : NSMutableArray { 24 | NSMutableArray *array; // An array to use for storing objects in the heap. 25 | NSComparisonResult sortOrder; // Whether to sort objects ascending or not. 26 | unsigned long mutations; // Used to track mutations for NSFastEnumeration. 27 | } 28 | 29 | /** 30 | Determine whether the receiver contains a given object, matched using the == operator. 31 | 32 | @param anObject The object to test for membership in the heap. 33 | @return @c YES if @a anObject is in the heap, @c NO if it is @c nil or not present. 34 | 35 | @see containsObject: 36 | @see removeObjectIdenticalTo: 37 | */ 38 | - (BOOL) containsObjectIdenticalTo:(id)anObject; 39 | 40 | /** 41 | Remove @b all occurrences of @a anObject, matched using @c isEqual:. 42 | 43 | @param anObject The object to be removed from the heap. 44 | 45 | If the heap is empty, @a anObject is @c nil, or no object matching @a anObject is found, there is no effect, aside from the possible overhead of searching the contents. 46 | 47 | @see containsObject; 48 | @see removeAllObjects 49 | @see removeObjectIdenticalTo: 50 | */ 51 | - (void) removeObject:(id)anObject; 52 | 53 | /** 54 | Remove @b all occurrences of @a anObject, matched using the == operator. 55 | 56 | @param anObject The object to be removed from the heap. 57 | 58 | If the heap is empty, @a anObject is @c nil, or no object matching @a anObject is found, there is no effect, aside from the possible overhead of searching the contents. 59 | 60 | @see containsObjectIdenticalTo: 61 | @see removeAllObjects 62 | @see removeObject: 63 | */ 64 | - (void) removeObjectIdenticalTo:(id)anObject; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHAbstractListCollection.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHAbstractListCollection.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHLinkedList.h" 14 | 15 | /** 16 | @file CHAbstractListCollection.h 17 | An abstract class which implements common behaviors of list-based collections. 18 | */ 19 | 20 | /** 21 | An abstract class which implements common behaviors of list-based collections. This class has a single instance variable on which all the implemented methods act, and also conforms to several protocols: 22 | 23 | - NSCoding 24 | - NSCopying 25 | - NSFastEnumeration 26 | 27 | Rather than enforcing that this class be abstract, the contract is implied. 28 | */ 29 | @interface CHAbstractListCollection : NSObject 30 | { 31 | id list; // List used for storing contents of collection. 32 | } 33 | 34 | - (id) initWithArray:(NSArray*)anArray; 35 | - (NSArray*) allObjects; 36 | - (BOOL) containsObject:(id)anObject; 37 | - (BOOL) containsObjectIdenticalTo:(id)anObject; 38 | - (NSUInteger) count; 39 | - (void) exchangeObjectAtIndex:(NSUInteger)idx1 withObjectAtIndex:(NSUInteger)idx2; 40 | - (NSUInteger) indexOfObject:(id)anObject; 41 | - (NSUInteger) indexOfObjectIdenticalTo:(id)anObject; 42 | - (id) objectAtIndex:(NSUInteger)index; 43 | - (NSEnumerator*) objectEnumerator; 44 | - (NSArray*) objectsAtIndexes:(NSIndexSet*)indexes; 45 | - (void) removeAllObjects; 46 | - (void) removeObject:(id)anObject; 47 | - (void) removeObjectAtIndex:(NSUInteger)index; 48 | - (void) removeObjectIdenticalTo:(id)anObject; 49 | - (void) removeObjectsAtIndexes:(NSIndexSet*)indexes; 50 | - (void) replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject; 51 | 52 | #pragma mark Adopted Protocols 53 | 54 | - (void) encodeWithCoder:(NSCoder*)encoder; 55 | - (id) initWithCoder:(NSCoder*)decoder; 56 | - (id) copyWithZone:(NSZone*)zone; 57 | - (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState*)state 58 | objects:(id*)stackbuf 59 | count:(NSUInteger)len; 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/AddNoteViewController.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import 4 | #import "iOS_Constants.h" 5 | 6 | 7 | ///declare delagate methods 8 | 9 | @class AddNoteViewController; 10 | @class ChecklistItem; 11 | 12 | /// We pass the creted information to checkviewcontroller using delegate method. 13 | @protocol AddItemViewControllerDelegate 14 | 15 | ///This method declares when user tap on the cancel button, it will dismiss the addnote view controller presenting without saving the data 16 | - (void)addItemViewControllerDidCancel:(AddNoteViewController *)controller; 17 | 18 | 19 | 20 | ///This method pass the relevant "added" information such as notes, whether to remind to checklistview controller 21 | - (void)addItemViewController:(AddNoteViewController *)controller didFinishAddingItem:(ChecklistItem *)item; 22 | 23 | 24 | 25 | 26 | ///This method pass the relevant "edited" information such as task, notes, whether to remind to checklistview controller 27 | - (void)addItemViewController:(AddNoteViewController *)controller didFinishEditingItem:(ChecklistItem *)item; 28 | @end 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | /// confirm that textfield, datpicker and actionsheet delegates to self 47 | @interface AddNoteViewController : UITableViewController 48 | 49 | 50 | /// textField is a field where user key in the task information. 51 | //@property (strong, nonatomic) IBOutlet UITextField *textField; 52 | 53 | /// notesField is a field where user key in the additional information. 54 | @property (strong, nonatomic) IBOutlet UITextView *notesField; 55 | 56 | /// We create doneBarButton as IBOutlet so that we can disable the done button if the text field is empty. 57 | //@property (nonatomic, strong) IBOutlet UIBarButtonItem *doneBarButton; 58 | 59 | ///confirms delegate method 60 | @property (nonatomic, weak) id delegate; 61 | 62 | ///We declare itemtoedit method to display information for user to edit 63 | @property (nonatomic, strong) ChecklistItem *itemToEdit; 64 | 65 | ///this is the notification time which user selects 66 | @property (nonatomic, strong) IBOutlet UILabel *dueDateLabel; 67 | 68 | ///This outlet will be only enables if the notes is editing mode 69 | @property (nonatomic, strong) IBOutlet UIBarButtonItem *shareButton; 70 | 71 | ///When the user tap on the share button we bring up this activity controller 72 | @property (nonatomic, strong) UIActivityViewController *activityViewController; 73 | 74 | 75 | 76 | 77 | ///create IBActions 78 | 79 | ///We create cancel IBAction. when user tap on cancel button, we dismiss the presenting view controller by calling AddItemViewControllerDelegate using delegate method 80 | - (IBAction)cancel; 81 | 82 | ///We create done IBAction. when user tap done button, we dismiss the presenting view controller by calling didFinishAddingItem using delegate method which will pass the added/edited information to checklistviewcontroller 83 | - (IBAction)done; 84 | 85 | ///We create share button for user to tap to share the notes 86 | -(IBAction) shareButtonClicked:(id)sender; 87 | 88 | 89 | 90 | 91 | 92 | -(void)customizeAppearance; 93 | 94 | 95 | @end -------------------------------------------------------------------------------- /Backlog Notes/Backlog Notes.xcodeproj/xcuserdata/Kalai.xcuserdatad/xcschemes/iOS Notes.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /Backlog Notes/Backlog Notes.xcodeproj/xcuserdata/partho.xcuserdatad/xcschemes/iOS Notes.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/ChecklistItem.m: -------------------------------------------------------------------------------- 1 | 2 | #import "ChecklistItem.h" 3 | #import "DataModel.h" 4 | 5 | @implementation ChecklistItem 6 | 7 | 8 | ///synthesize the declared properties 9 | @synthesize notes; 10 | @synthesize dueDate, shouldRemind, itemId; 11 | 12 | 13 | 14 | ///method to decode 15 | - (id)initWithCoder:(NSCoder *)aDecoder 16 | { 17 | if ((self = [super init])) { 18 | self.notes = [aDecoder decodeObjectForKey:@"Notes"]; 19 | self.dueDate = [aDecoder decodeObjectForKey:@"DueDate"]; 20 | self.shouldRemind = [aDecoder decodeBoolForKey:@"ShouldRemind"]; 21 | self.itemId = [aDecoder decodeIntForKey:@"ItemID"]; 22 | } 23 | return self; 24 | } 25 | 26 | 27 | 28 | ///method to encode 29 | - (void)encodeWithCoder:(NSCoder *)aCoder 30 | { 31 | [aCoder encodeObject:self.notes forKey:@"Notes"]; 32 | [aCoder encodeObject:self.dueDate forKey:@"DueDate"]; 33 | [aCoder encodeBool:self.shouldRemind forKey:@"ShouldRemind"]; 34 | [aCoder encodeInt:self.itemId forKey:@"ItemID"]; 35 | } 36 | 37 | 38 | 39 | ///We need to assign an id for each item. 40 | - (id)init 41 | { 42 | if (self = [super init]) { 43 | self.itemId = [DataModel nextChecklistItemId]; 44 | } 45 | return self; 46 | } 47 | 48 | 49 | 50 | ///We need to assign an id for each item so that we can easily identify. 51 | - (UILocalNotification *)notificationForThisItem 52 | { 53 | NSArray *allNotifications = [[UIApplication sharedApplication] scheduledLocalNotifications]; 54 | for (UILocalNotification *notification in allNotifications) { 55 | NSNumber *number = [notification.userInfo objectForKey:@"ItemID"]; 56 | if (number != nil && [number intValue] == self.itemId) { 57 | 58 | return notification; 59 | } 60 | } 61 | return nil; 62 | } 63 | 64 | 65 | 66 | ///We schedule notification here for the selected item. If there is any existing notification for this item, we remove them so that only latest alarm time will be fired. 67 | - (void)scheduleNotification 68 | { 69 | 70 | UILocalNotification *existingNotification = [self notificationForThisItem]; 71 | if (existingNotification != nil) { 72 | 73 | NSLog(@"Found an existing notification %@", existingNotification); 74 | 75 | [[UIApplication sharedApplication] cancelLocalNotification:[self notificationForThisItem]]; 76 | 77 | } 78 | 79 | 80 | 81 | if (self.shouldRemind && [self.dueDate compare:[NSDate date]] != NSOrderedAscending) { 82 | UILocalNotification *localNotification = [[UILocalNotification alloc] init]; 83 | localNotification.fireDate = self.dueDate; 84 | localNotification.timeZone = [NSTimeZone defaultTimeZone]; 85 | localNotification.alertBody = self.notes; 86 | localNotification.soundName = UILocalNotificationDefaultSoundName; 87 | localNotification.userInfo = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:self.itemId] forKey:@"ItemID"]; 88 | 89 | 90 | [[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; 91 | NSLog(@"Scheduled notification %@ for itemId %d", localNotification, self.itemId); 92 | } 93 | } 94 | 95 | 96 | 97 | - (void)dealloc 98 | { 99 | UILocalNotification *existingNotification = [self notificationForThisItem]; 100 | if (existingNotification != nil) { 101 | // NSLog(@"Removing existing notification %@", existingNotification); 102 | [[UIApplication sharedApplication] cancelLocalNotification: 103 | existingNotification]; 104 | } 105 | } 106 | 107 | 108 | 109 | 110 | 111 | @end 112 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHCircularBuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHCircularBuffer.h 3 | 4 | Copyright (c) 2009-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "Util.h" 14 | 15 | /** 16 | @file CHCircularBuffer.h 17 | 18 | A circular buffer array. 19 | */ 20 | 21 | /** 22 | A circular buffer is a structure that emulates a continuous ring of N data slots. This class uses a C array and tracks the indexes of the front and back elements in the buffer, such that the first element is treated as logical index 0 regardless of where it is actually stored. The buffer dynamically expands to accommodate added objects. This type of storage is ideal for scenarios where objects are added and removed only at one or both ends (such as a stack or queue) but still supports all normal NSMutableArray functionality. 23 | 24 | @note Any method inherited from NSArray or NSMutableArray is supported by this class and its children. Please see the documentation for those classes for details. 25 | */ 26 | @interface CHCircularBuffer : NSMutableArray { 27 | __strong id *array; // Primitive C array for storing collection contents. 28 | NSUInteger arrayCapacity; // How many pointers @a array can accommodate. 29 | NSUInteger count; // The number of objects currently in the buffer. 30 | NSUInteger headIndex; // The array index of the first object. 31 | NSUInteger tailIndex; // The array index after the last object. 32 | unsigned long mutations; // Tracks mutations for NSFastEnumeration. 33 | } 34 | 35 | // The following methods are undocumented since they are only reimplementations. 36 | // Users should consult the API documentation for NSArray and NSMutableArray. 37 | 38 | - (id) initWithArray:(NSArray*)anArray; 39 | 40 | - (NSArray*) allObjects; 41 | - (BOOL) containsObject:(id)anObject; 42 | - (BOOL) containsObjectIdenticalTo:(id)anObject; 43 | - (void) exchangeObjectAtIndex:(NSUInteger)idx1 withObjectAtIndex:(NSUInteger)idx2; 44 | - (id) firstObject; 45 | - (NSUInteger) indexOfObject:(id)anObject; 46 | - (NSUInteger) indexOfObjectIdenticalTo:(id)anObject; 47 | - (id) lastObject; 48 | - (NSEnumerator*) objectEnumerator; 49 | - (NSArray*) objectsAtIndexes:(NSIndexSet*)indexes; 50 | - (void) removeAllObjects; 51 | - (void) removeFirstObject; 52 | - (void) removeLastObject; 53 | - (void) removeObject:(id)anObject; 54 | - (void) removeObjectIdenticalTo:(id)anObject; 55 | - (void) removeObjectsAtIndexes:(NSIndexSet*)indexes; 56 | - (void) replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject; 57 | - (NSEnumerator*) reverseObjectEnumerator; 58 | 59 | #pragma mark Adopted Protocols 60 | 61 | - (void) encodeWithCoder:(NSCoder*)encoder; 62 | - (id) initWithCoder:(NSCoder*)decoder; 63 | - (id) copyWithZone:(NSZone*)zone; 64 | - (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState*)state 65 | objects:(id*)stackbuf 66 | count:(NSUInteger)len; 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/AppDelegate.m: -------------------------------------------------------------------------------- 1 | 2 | #import "AppDelegate.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 7 | { 8 | // Override point for customization after application launch. 9 | 10 | /* 11 | [self customizeAppearance]; 12 | 13 | // Customize the navigation bar title 14 | [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: 15 | [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], UITextAttributeTextColor, 16 | [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8],UITextAttributeTextShadowColor, 17 | [NSValue valueWithUIOffset:UIOffsetMake(0, 3)],UITextAttributeTextShadowOffset, 18 | [UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:20.0], UITextAttributeFont, 19 | 20 | nil]]; 21 | 22 | */ 23 | 24 | return YES; 25 | } 26 | 27 | 28 | /// Customize our app with the theme 29 | 30 | -(void)customizeAppearance 31 | { 32 | 33 | //navigation bar 34 | UIImage* navbar = [UIImage imageNamed:@"menubar.png"]; 35 | [[UINavigationBar appearance] setBackgroundImage:navbar forBarMetrics:UIBarMetricsDefault]; 36 | 37 | 38 | //bar button 39 | UIImage *barButton = [[UIImage imageNamed:@"menubar-button.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(-1, 5, -1, 5)]; 40 | [[UIBarButtonItem appearance] setBackgroundImage:barButton forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; 41 | 42 | } 43 | 44 | - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification 45 | { 46 | 47 | } 48 | 49 | 50 | - (void)applicationWillResignActive:(UIApplication *)application 51 | { 52 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 53 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 54 | } 55 | 56 | - (void)applicationDidEnterBackground:(UIApplication *)application 57 | { 58 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 59 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 60 | } 61 | 62 | - (void)applicationWillEnterForeground:(UIApplication *)application 63 | { 64 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 65 | } 66 | 67 | - (void)applicationDidBecomeActive:(UIApplication *)application 68 | { 69 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 70 | } 71 | 72 | - (void)applicationWillTerminate:(UIApplication *)application 73 | { 74 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /Backlog Notes/Backlog Notes.xcodeproj/xcuserdata/parthobiswas.xcuserdatad/xcschemes/Backlog Notes.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHRedBlackTree.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHRedBlackTree.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | Copyright (c) 2002, Phillip Morelock 6 | 7 | This source code is released under the ISC License. 8 | 9 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 10 | 11 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 12 | */ 13 | 14 | #import "CHAbstractBinarySearchTree.h" 15 | 16 | #define kBLACK 0 17 | #define kRED 1 18 | 19 | /** 20 | @file CHRedBlackTree.h 21 | A Red-Black tree implementation of CHSearchTree. 22 | */ 23 | 24 | /** 25 | A Red-Black tree, a balanced binary search tree with guaranteed O(log n) access. The algorithms for insertion and removal in this implementation have been adapted from code in the Red-Black trees tutorial, which is in the public domain, courtesy of Julienne Walker. Method names have been changed to match the APIs of existing Cocoa collections provided by Apple. 26 | 27 | A Red-Black tree has a few fundamental rules: 28 |
    29 |
  1. Every node is red or black.
  2. 30 |
  3. All leaves (null children) are black, even when the parent is black.
  4. 31 |
  5. If a node is red, both of its children must be black.
  6. 32 |
  7. Every path from a node to its leaves has the same number of black nodes.
  8. 33 |
  9. The root of the tree is black. (Optional, but simplifies things.)
  10. 34 |
35 | 36 | These constraints, and in particular the black path height and non-consecutive red nodes, guarantee that longest path from the root to a leaf is no more than twice as long as the shortest path from the root to a leaf. (This is true since the shortest possible path has only black nodes, and the longest possible path alternates between red and black nodes.) The result is a fairly balanced tree. 37 | 38 |
Figure 1 - A sample Red-Black tree
39 | @image html red-black-tree.png 40 | 41 | The sentinel node (which appears whenever a child link would be null) is always colored black. The algorithms for balancing Red-Black trees can be made to work without explicitly representing the nil leaf children, but they work better and with much less heartache if those links are present. The same sentinel value is used for every leaf link, so it only adds the cost of storing one more node. In addition, tracing a path down the tree doesn't have to check for null children at each step, so insertion, search, and deletion are all a little bit faster. 42 | 43 | Red-Black trees were originally described in the following papers: 44 | 45 |
46 | R. Bayer. "Binary B-Trees for Virtual Memory." ACM-SIGFIDET Workshop on 47 | Data Description, 1971, San Diego, California, Session 5B, p. 219-235. 48 |
49 | 50 |
51 | R. Bayer and E. M. McCreight. "Organization and Maintenance of Large Ordered 52 | Indexes." Acta Informatica 1, 173-189, 1972. 53 |
54 | 55 |
56 | L. J. Guibas and R. Sedgewick. "A dichromatic framework for balanced trees." 57 | 19th Annual Symposium on Foundations of Computer Science, pp.8-21, 58 | 1978. (DOI link to IEEE) 59 |
60 | */ 61 | @interface CHRedBlackTree : CHAbstractBinarySearchTree 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHAVLTree.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHAVLTree.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHAbstractBinarySearchTree.h" 14 | 15 | /** 16 | @file CHAVLTree.h 17 | An AVL tree implementation of CHSearchTree. 18 | */ 19 | 20 | /** 21 | An AVL tree, a balanced binary search tree with guaranteed O(log n) access. The algorithms for insertion and removal in this implementation have been adapted from code in the AVL trees tutorial, which is in the public domain, courtesy of Julienne Walker. Method names have been changed to match the APIs of existing Cocoa collections provided by Apple. 22 | 23 | AVL trees are more strictly balanced that most self-balancing binary trees, and consequently have slower insertion and deletion performance but faster lookup, although all operations are still O(log n) in both average and worst cases. AVL trees are shallower than their counterparts; for example, the maximum depth of AVL trees is 1.44 log n, versus 2 log n for Red-Black trees. In practice, AVL trees are quite competitive with other self-balancing trees, and the insertion and removal algorithms are much easier to understand. 24 | 25 | In an AVL tree, the heights of the child subtrees of any node may differ by at most one. If the heights differ by more than one, then one or more rotations around the unbalanced node are required to rebalance the tree. The 4 possible unbalanced cases and how to rebalance them are shown in Figure 1. 26 | 27 |
Figure 1 - Rebalancing cases in an AVL tree.
28 | @image html avl-tree-rotations.png 29 | 30 | Although traditional AVL algorithms track the height of each node (one plus the maximum of the height of its chilren) this approach requires updating all the heights along the search path when inserting or removing objects. This penalty can be mitigated by instead storing a balance factor for each node, calculated as the height of the right subtree minus the height of the left subtree. (Any node with a balance factor of -1, 0, or +1 is considered to bebalanced.) If the balance factor of a node is -2 or +2, then rebalancing is required. 31 | 32 | Balance factors are updated when rotating, and at each rotation we must proceed back up the search path. However, on deletion, we can drop out of the loop when a node's balance factor becomes -1 or +1, since the heights of its subtrees has not changed. (If a node's balance factor becomes 0, the parent's balance factor must be updated, and may change to -2 or +2, requiring another rebalance.) 33 | 34 | Figure 2 shows a sample AVL tree, with tree heights in blue and balance factors in red beside each node. 35 | 36 |
Figure 2 - Sample AVL tree and balancing data.
37 | @image html avl-tree-sample.png 38 | 39 | AVL trees were originally described in the following paper: 40 | 41 |
42 | G. M. Adelson-Velsky and E. M. Landis. "An algorithm for the organization of information." Proceedings of the USSR Academy of Sciences, 146:263-266, 1962. (English translation in Soviet Mathematics, 3:1259-1263, 1962.) 43 |
44 | */ 45 | @interface CHAVLTree : CHAbstractBinarySearchTree 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHSortedDictionary.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHSortedDictionary.h 3 | 4 | Copyright (c) 2009-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHMutableDictionary.h" 14 | #import "CHSortedSet.h" 15 | 16 | /** 17 | @file CHSortedDictionary.h 18 | 19 | A dictionary which enumerates keys according to their natural sorted order. 20 | */ 21 | 22 | /** 23 | A dictionary which enumerates keys according to their natural sorted order. The following additional operations are provided to take advantage of the ordering: 24 | - \link #firstKey\endlink 25 | - \link #lastKey\endlink 26 | - \link #subsetFromKey:toKey:options:\endlink 27 | 28 | Key-value entries are inserted just as in a normal dictionary, including replacement of values for existing keys, as detailed in \link NSMutableDictionary#setObject:forKey: -[NSMutableDictionary setObject:forKey:]\endlink. However, an additional CHSortedSet structure is used in parallel to sort the keys, and keys are enumerated in that order. 29 | 30 | Implementations of sorted dictionaries (aka "maps") in other languages include the following: 31 | 32 | - SortedMap (Java) 33 | - map (C++) 34 | 35 | @note Any method inherited from NSDictionary or NSMutableDictionary is supported, but only overridden methods are listed here. 36 | 37 | @see CHSortedSet 38 | */ 39 | @interface CHSortedDictionary : CHMutableDictionary { 40 | id sortedKeys; 41 | } 42 | 43 | #pragma mark Querying Contents 44 | /** @name Querying Contents */ 45 | // @{ 46 | 47 | /** 48 | Returns the minimum key in the receiver, according to natural sorted order. 49 | 50 | @return The minimum key in the receiver, or @c nil if the receiver is empty. 51 | 52 | @see lastKey 53 | */ 54 | - (id) firstKey; 55 | 56 | /** 57 | Returns the maximum key in the receiver, according to natural sorted order. 58 | 59 | @return The maximum key in the receiver, or @c nil if the receiver is empty. 60 | 61 | @see firstKey 62 | */ 63 | - (id) lastKey; 64 | 65 | /** 66 | Returns a new dictionary containing the entries for keys delineated by two given objects. The subset is a shallow copy (new memory is allocated for the structure, but the copy points to the same objects) so any changes to the objects in the subset affect the receiver as well. The subset is an instance of the same class as the receiver. 67 | 68 | @param start Low endpoint of the subset to be returned; need not be a key in receiver. 69 | @param end High endpoint of the subset to be returned; need not be a key in receiver. 70 | @param options A combination of @c CHSubsetConstructionOptions values that specifies how to construct the subset. Pass 0 for the default behavior, or one or more options combined with a bitwise OR to specify different behavior. 71 | @return A new sorted dictionary containing the key-value entries delineated by @a start and @a end. The contents of the returned subset depend on the input parameters as follows: 72 | - If both @a start and @a end are @c nil, all keys in the receiver are included. (Equivalent to calling @c -copy.) 73 | - If only @a start is @c nil, keys that match or follow @a start are included. 74 | - If only @a end is @c nil, keys that match or preceed @a start are included. 75 | - If @a start comes before @a end in an ordered set, keys between @a start and @a end (or which match either object) are included. 76 | - Otherwise, all keys @b except those that fall between @a start and @a end are included. 77 | */ 78 | - (NSMutableDictionary*) subsetFromKey:(id)start 79 | toKey:(id)end 80 | options:(CHSubsetConstructionOptions)options; 81 | 82 | // @} 83 | @end 84 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHSinglyLinkedList.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHSinglyLinkedList.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | Copyright (c) 2002, Phillip Morelock 6 | 7 | This source code is released under the ISC License. 8 | 9 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 10 | 11 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 12 | */ 13 | 14 | #import "CHLinkedList.h" 15 | 16 | /** 17 | @file CHSinglyLinkedList.h 18 | A standard singly-linked list implementation with pointers to head and tail. 19 | */ 20 | 21 | /** A struct for nodes in a CHSinglyLinkedList. */ 22 | typedef struct CHSinglyLinkedListNode { 23 | id object; ///< The object associated with this node in the list. 24 | __strong struct CHSinglyLinkedListNode *next; ///< The next node in the list. 25 | } CHSinglyLinkedListNode; 26 | 27 | #pragma mark - 28 | 29 | /** 30 | A standard singly-linked list implementation with pointers to head and tail. This is ideally suited for use in LIFO and FIFO structures (stacks and queues). The lack of backwards links precludes backwards enumeration, and removing from the tail of the list is O(n), rather than O(1). However, other operations are slightly faster than for doubly-linked lists. Nodes are represented with C structs, providing much faster performance than Objective-C objects. 31 | 32 | This implementation uses a dummy head node, which simplifies both insertion and deletion by eliminating the need to check whether the first node in the list must change. We opt not to use a dummy tail node since the lack of a previous pointer makes starting at the end of the list rather pointless. The pointer to the tail (either the dummy head node or the last "real" node in the list) is only used for inserting at the end without traversing the entire list first. The figures below demonstrate what a singly-linked list looks like when it contains 0 objects, 1 object, and 2 or more objects. 33 | 34 | @image html singly-linked-0.png Figure 1 - Singly-linked list with 0 objects. 35 | 36 | @image html singly-linked-1.png Figure 2 - Singly-linked list with 1 object. 37 | 38 | @image html singly-linked-N.png Figure 3 - Singly-linked list with 2+ objects. 39 | 40 | To reduce code duplication, all methods that append or prepend objects to the list call \link #insertObject:atIndex:\endlink, and the methods to remove the first or last objects use \link #removeObjectAtIndex:\endlink underneath. 41 | 42 | Singly-linked lists are well-suited as an underlying collection for other data structures, such as stacks and queues (see CHListStack and CHListQueue). The same functionality can be achieved using a circular buffer and an array, and many libraries choose to do so when objects are only added to or removed from the ends, but the dynamic structure of a linked list is much more flexible when inserting and deleting in the middle of a list. 43 | 44 | The primary weakness of singly-linked lists is the absence of a previous link. Since insertion and deletion involve changing the @c next link of the preceding node, and there is no way to step backwards through the list, traversal must always begin at the head, even if searching for an index that is very close to the tail. This does not mean that singly-linked lists are inherently bad, only that they are not well-suited for all possible applications. As usual, all data access attributes should be considered before choosing a data strcuture. 45 | */ 46 | @interface CHSinglyLinkedList : NSObject 47 | { 48 | __strong CHSinglyLinkedListNode *head; // Dummy node at the front of the list. 49 | __strong CHSinglyLinkedListNode *tail; // Pointer to last node in a list. 50 | __strong CHSinglyLinkedListNode *cachedNode; // Pointer to last accessed node. 51 | NSUInteger cachedIndex; // Index of last accessed node. 52 | NSUInteger count; // The number of objects currently stored in a list. 53 | unsigned long mutations; // Tracks mutations for NSFastEnumeration. 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHAnderssonTree.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHAnderssonTree.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHAbstractBinarySearchTree.h" 14 | 15 | /** 16 | @file CHAnderssonTree.h 17 | An AA-tree implementation of CHSearchTree. 18 | */ 19 | 20 | /** 21 | An AA-tree, a balanced binary search tree with guaranteed O(log n) access. The algorithms for insertion and removal have been adapted from code in the Andersson Tree tutorial, which is in the public domain, courtesy of Julienne Walker. Method names have been changed to match the APIs of existing Cocoa collections provided by Apple. 22 | 23 | The AA-tree (named after its creator, Arne Andersson) is extremely similar to a Red-Black tree. Both are abstractions of B-trees designed to make insertion and removal easier to understand and implement. In a Red-Black tree, a red node represents a horizontal link to a subtree rooted at the same level. In the AA-tree, horizontal links are represented by storing a node's level, not color. (A node whose level is the same as its parent is equivalent to a "red" node.) 24 | 25 | Similar to a Red-Black tree, there are several rules which must be true for an AA-tree to remain valid: 26 | 27 |
    28 |
  1. The level of a leaf node is one.
  2. 29 |
  3. The level of a left child is less than that of its parent.
  4. 30 |
  5. The level of a right child is less than or equal to that of its parent.
  6. 31 |
  7. The level of a right grandchild is less than that of its grandparent.
  8. 32 |
  9. Every node of level greater than one must have two children.
  10. 33 |
34 | 35 | The AA-tree was invented to simplify the algorithms for balancing an abstract B-tree, and does so with a simple restriction: horizontal links ("red nodes") are only allowed as the right child of a node. If we represent both node level and the implicit red colors, an AA-tree looks like the following example: 36 | 37 |
38 | Figure 1 - A sample AA-tree with node levels and implicit coloring.
39 | @image html aa-tree-sample.png 40 |
41 | 42 | Because horizontal links are only allowed on the right, rather than balancing all 7 possible subtrees of 2 and 3 nodes (shown in Figure 2) when removing, an AA-tree need only be concerned with 2: the first and last forms in the figure. 43 | 44 |
45 | Figure 2 - All possible 2- and 3-node subtrees 46 | @image html aa-tree-shapes.png 47 |
48 | 49 | Consequently, only two primitive balancing operations are necessary. The @c skew operation eliminates red nodes as left children, while the @c split operation eliminates consecutive right-child red nodes. (Both of these operations are depicted in the figures below.) 50 | 51 |
52 | Figure 3 - The skew operation.
53 | @image html aa-tree-skew.png 54 |
55 | 56 |
57 | Figure 4 - The split operation.
58 | @image html aa-tree-split.png 59 |
60 | 61 | Performance of an AA-tree is roughly equivalent to that of a Red-Black tree. While an AA-tree makes more rotations than a Red-Black tree, the algorithms are simpler to understand and tend to be somewhat faster, and all of this balances out to result in similar performance. A Red-Black tree is more consistent in its performance than an AA-tree, but an AA-tree tends to be flatter, which results in slightly faster search. 62 | 63 | AA-trees were originally described in the following paper: 64 | 65 |
66 | A. Andersson. "Balanced search trees made simple." Workshop on Algorithms 67 | and Data Structures, pp.60-71. Springer Verlag, 1993. 68 |
69 | 70 | (See PDF original or PostScript original) 71 | */ 72 | @interface CHAnderssonTree : CHAbstractBinarySearchTree 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHDoublyLinkedList.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHDoublyLinkedList.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | Copyright (c) 2002, Phillip Morelock 6 | 7 | This source code is released under the ISC License. 8 | 9 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 10 | 11 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 12 | */ 13 | 14 | #import "CHLinkedList.h" 15 | 16 | /** 17 | @file CHDoublyLinkedList.h 18 | A standard doubly-linked list implementation with pointers to head and tail. 19 | */ 20 | 21 | /** A struct for nodes in a CHDoublyLinkedList. */ 22 | typedef struct CHDoublyLinkedListNode { 23 | id object; ///< The object associated with this node in the list. 24 | __strong struct CHDoublyLinkedListNode *next; ///< Next node in the list. 25 | __strong struct CHDoublyLinkedListNode *prev; ///< Previous node in the list. 26 | } CHDoublyLinkedListNode; 27 | 28 | #pragma mark - 29 | 30 | /** 31 | A standard doubly-linked list implementation with pointers to head and tail. The extra 'previous' link allows for reverse enumeration and cheaper removal for objects near the tail of the list. The tradeoff is a little extra storage in each list node and a little extra work when inserting and removing. Nodes are represented with C structs, providing much faster performance than Objective-C objects. 32 | 33 | The use of head and tail nodes allows for simplification of the algorithms for insertion and deletion, since the special cases of checking whether a node is the first or last in the list (and handling the next and previous pointers) are done away with. The figures below demonstrate what a doubly-linked list looks like when it contains 0 objects, 1 object, and 2 or more objects. 34 | 35 | @image html doubly-linked-0.png Figure 1 - Doubly-linked list with 0 objects. 36 | 37 | @image html doubly-linked-1.png Figure 2 - Doubly-linked list with 1 object. 38 | 39 | @image html doubly-linked-N.png Figure 3 - Doubly-linked list with 2+ objects. 40 | 41 | Just as with sentinel nodes used in binary search trees, the object pointer in the head and tail nodes can be nil or set to the value being searched for. This means there is no need to check whether the next node is null before moving on; just stop at the node whose object matches, then check after the match is found whether the node containing it was the head/tail or a valid internal node. 42 | 43 | The operations \link #insertObject:atIndex:\endlink and \link #removeObjectAtIndex:\endlink take advantage of the bi-directional links, and search from the closest possible point. To reduce code duplication, all methods that append or prepend objects call \link #insertObject:atIndex:\endlink, and the methods to remove the first or last objects use \link #removeObjectAtIndex:\endlink underneath. 44 | 45 | Doubly-linked lists are well-suited as an underlying collection for other data structures, such as a deque (double-ended queue) like the one declared in CHListDeque. The same functionality can be achieved using a circular buffer and an array, and many libraries choose to do so when objects are only added to or removed from the ends, but the dynamic structure of a linked list is much more flexible when inserting and deleting in the middle of a list. 46 | */ 47 | @interface CHDoublyLinkedList : NSObject 48 | { 49 | __strong CHDoublyLinkedListNode *head; // Dummy node at the front of the list. 50 | __strong CHDoublyLinkedListNode *tail; // Dummy node at the back of the list. 51 | __strong CHDoublyLinkedListNode *cachedNode; // Pointer to last accessed node. 52 | NSUInteger cachedIndex; // Index of last accessed node. 53 | NSUInteger count; // The number of objects currently in the list. 54 | unsigned long mutations; // Tracks mutations for NSFastEnumeration. 55 | } 56 | 57 | /** 58 | Returns an enumerator that accesses each object in the receiver from back to front. 59 | 60 | @return An enumerator that accesses each object in the receiver from back to front. The enumerator returned is never @c nil; if the receiver is empty, the enumerator will always return @c nil for \link NSEnumerator#nextObject -nextObject\endlink and an empty array for \link NSEnumerator#allObjects -allObjects\endlink. 61 | 62 | @attention The enumerator retains the collection. Once all objects in the enumerator have been consumed, the collection is released. 63 | @warning Modifying a collection while it is being enumerated is unsafe, and may cause a mutation exception to be raised. 64 | */ 65 | - (NSEnumerator*) reverseObjectEnumerator; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/DALinedTextView/DALinedTextView.m: -------------------------------------------------------------------------------- 1 | 2 | #import "DALinedTextView.h" 3 | 4 | #define DEFAULT_HORIZONTAL_COLOR [UIColor colorWithRed:0.722f green:0.910f blue:0.980f alpha:0.9f] 5 | #define DEFAULT_VERTICAL_COLOR [UIColor colorWithRed:0.957f green:0.416f blue:0.365f alpha:0.9f] 6 | #define DEFAULT_MARGINS UIEdgeInsetsMake(10.0f, 10.0f, 0.0f, 10.0f) 7 | 8 | @interface DALinedTextView () 9 | 10 | @property (nonatomic, assign) UIView *webDocumentView; 11 | 12 | @end 13 | 14 | @implementation DALinedTextView 15 | 16 | + (void)initialize 17 | { 18 | if (self == [DALinedTextView class]) 19 | { 20 | id appearance = [self appearance]; 21 | [appearance setContentMode:UIViewContentModeRedraw]; 22 | [appearance setHorizontalLineColor:DEFAULT_HORIZONTAL_COLOR]; 23 | [appearance setVerticalLineColor:DEFAULT_VERTICAL_COLOR]; 24 | [appearance setMargins:DEFAULT_MARGINS]; 25 | } 26 | } 27 | 28 | #pragma mark - Superclass overrides 29 | 30 | - (id)initWithFrame:(CGRect)frame 31 | { 32 | self = [super initWithFrame:frame]; 33 | if (self) 34 | { 35 | // Recycling the font is necessary 36 | // For proper line/text alignment 37 | UIFont *font = self.font; 38 | self.font = nil; 39 | self.font = font; 40 | 41 | // We need to grab the underlying webView 42 | // And resize it along with the margins 43 | self.webDocumentView = [self.subviews objectAtIndex:0]; 44 | self.margins = [self.class.appearance margins]; 45 | } 46 | return self; 47 | } 48 | 49 | - (void)setContentSize:(CGSize)contentSize 50 | { 51 | contentSize = (CGSize) { 52 | .width = contentSize.width - self.margins.left - self.margins.right, 53 | .height = MAX(contentSize.height, self.bounds.size.height - self.margins.top) 54 | }; 55 | self.webDocumentView.frame = (CGRect) { 56 | .origin = self.webDocumentView.frame.origin, 57 | .size = contentSize 58 | }; 59 | [super setContentSize:contentSize]; 60 | } 61 | 62 | - (void)drawRect:(CGRect)rect 63 | { 64 | CGContextRef context = UIGraphicsGetCurrentContext(); 65 | CGContextSetLineWidth(context, 1.0f); 66 | 67 | if (self.horizontalLineColor) 68 | { 69 | CGContextBeginPath(context); 70 | CGContextSetStrokeColorWithColor(context, self.horizontalLineColor.CGColor); 71 | 72 | // Create un-mutated floats outside of the for loop. 73 | // Reduces memory access. 74 | CGFloat baseOffset = 7.0f + self.font.descender; 75 | CGFloat screenScale = [UIScreen mainScreen].scale; 76 | CGFloat boundsX = self.bounds.origin.x; 77 | CGFloat boundsWidth = self.bounds.size.width; 78 | 79 | // Only draw lines that are visible on the screen. 80 | // (As opposed to throughout the entire view's contents) 81 | NSInteger firstVisibleLine = MAX(1, (self.contentOffset.y / self.font.lineHeight)); 82 | NSInteger lastVisibleLine = ceilf((self.contentOffset.y + self.bounds.size.height) / self.font.lineHeight); 83 | for (NSInteger line = firstVisibleLine; line <= lastVisibleLine; ++line) 84 | { 85 | CGFloat linePointY = (baseOffset + (self.font.lineHeight * line)); 86 | // Rounding the point to the nearest pixel. 87 | // Greatly reduces drawing time. 88 | CGFloat roundedLinePointY = roundf(linePointY * screenScale) / screenScale; 89 | CGContextMoveToPoint(context, boundsX, roundedLinePointY); 90 | CGContextAddLineToPoint(context, boundsWidth, roundedLinePointY); 91 | } 92 | CGContextClosePath(context); 93 | CGContextStrokePath(context); 94 | } 95 | 96 | if (self.verticalLineColor) 97 | { 98 | CGContextBeginPath(context); 99 | CGContextSetStrokeColorWithColor(context, self.verticalLineColor.CGColor); 100 | CGContextMoveToPoint(context, -1.0f, self.contentOffset.y); 101 | CGContextAddLineToPoint(context, -1.0f, self.contentOffset.y + self.bounds.size.height); 102 | CGContextClosePath(context); 103 | CGContextStrokePath(context); 104 | } 105 | } 106 | 107 | - (void)setFont:(UIFont *)font 108 | { 109 | [super setFont:font]; 110 | [self setNeedsDisplay]; 111 | } 112 | 113 | #pragma mark - Property methods 114 | 115 | - (void)setHorizontalLineColor:(UIColor *)horizontalLineColor 116 | { 117 | _horizontalLineColor = horizontalLineColor; 118 | [self setNeedsDisplay]; 119 | } 120 | 121 | - (void)setVerticalLineColor:(UIColor *)verticalLineColor 122 | { 123 | _verticalLineColor = verticalLineColor; 124 | [self setNeedsDisplay]; 125 | } 126 | 127 | - (void)setMargins:(UIEdgeInsets)margins 128 | { 129 | _margins = margins; 130 | self.contentInset = (UIEdgeInsets) { 131 | .top = self.margins.top, 132 | .left = self.margins.left, 133 | .bottom = self.margins.bottom, 134 | .right = self.margins.right - self.margins.left 135 | }; 136 | [self setContentSize:self.contentSize]; 137 | } 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHAbstractBinarySearchTree_Internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHAbstractBinarySearchTree_Internal.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHAbstractBinarySearchTree.h" 14 | 15 | /** 16 | @file CHAbstractBinarySearchTree_Internal.h 17 | Contains \#defines for performing various traversals of binary search trees. 18 | 19 | This file is a private header that is only used by internal implementations, and is not included in the the compiled framework. The macros and variables are to be considered private and unsupported. 20 | 21 | Memory for stacks and queues is (re)allocated using NSScannedOption, since (if garbage collection is enabled) the nodes which may be placed in a stack or queue are known to the garbage collector. (If garbage collection is @b not enabled, the macros explicitly free the allocated memory.) We assume that a stack or queue will not outlive the nodes it contains, since they are only used in connection with an active tree (usually during insertion, removal or iteration). An enumerator may contain a stack or queue, but also retains the underlying collection, so correct retain-release calls will not leak. 22 | */ 23 | 24 | @interface CHAbstractBinarySearchTree () 25 | 26 | // NOTE: Subclasses should override the following methods to display any algorithm-specific information (such as the extra field used by self-balancing trees) in debugging output and generated DOT graphs. 27 | 28 | // This method determines the appearance of nodes in the graph produced by -debugDescription, and may be overriden by subclasses. The default implementation returns the -description for the object in the node, surrounded by quote marks. 29 | - (NSString*) debugDescriptionForNode:(CHBinaryTreeNode*)node; 30 | 31 | // This method determines the appearance of nodes in the graph produced by -dotGraphString, and may be overriden by subclasses. The default implementation creates an oval containing the value returned by -description for the object in the node. 32 | - (NSString*) dotGraphStringForNode:(CHBinaryTreeNode*)node; 33 | 34 | @end 35 | 36 | #pragma mark - 37 | 38 | /** 39 | Convenience function for allocating a new CHBinaryTreeNode. This centralizes the allocation so all subclasses can be sure they're allocating nodes correctly. Explicitly sets the "extra" field used by self-balancing trees to zero. 40 | 41 | @param anObject The object to be stored in the @a object field of the struct; may be @c nil. 42 | @return An struct allocated with @c NSAllocateCollectable() and @c NSScannedOption so the garbage collector (if enabled) will scan the object stored in the node, as well as the node's children (if any). 43 | */ 44 | HIDDEN CHBinaryTreeNode* CHCreateBinaryTreeNodeWithObject(id anObject); 45 | 46 | // These are used by subclasses; marked as HIDDEN to reduce external visibility. 47 | HIDDEN size_t kCHBinaryTreeNodeSize; 48 | 49 | #pragma mark Stack macros 50 | 51 | #define CHBinaryTreeStack_DECLARE() \ 52 | __strong CHBinaryTreeNode** stack; \ 53 | NSUInteger stackCapacity, stackSize 54 | 55 | #define CHBinaryTreeStack_INIT() { \ 56 | stackCapacity = 32; \ 57 | stack = NSAllocateCollectable(kCHBinaryTreeNodeSize*stackCapacity, NSScannedOption); \ 58 | stackSize = 0; \ 59 | } 60 | 61 | #define CHBinaryTreeStack_FREE(stack) { \ 62 | if (stack != NULL && kCHGarbageCollectionNotEnabled) \ 63 | free(stack); \ 64 | stack = NULL; \ 65 | } 66 | 67 | // Since this stack starts at 0 and goes to N-1, resizing is pretty simple. 68 | #define CHBinaryTreeStack_PUSH(node) { \ 69 | stack[stackSize++] = node; \ 70 | if (stackSize >= stackCapacity) { \ 71 | stackCapacity *= 2; \ 72 | stack = NSReallocateCollectable(stack, kCHPointerSize*stackCapacity, NSScannedOption); \ 73 | } \ 74 | } 75 | 76 | #define CHBinaryTreeStack_TOP \ 77 | ((stackSize > 0) ? stack[stackSize-1] : NULL) 78 | 79 | #define CHBinaryTreeStack_POP() \ 80 | ((stackSize > 0) ? stack[--stackSize] : NULL) 81 | 82 | 83 | #pragma mark Queue macros 84 | 85 | #define CHBinaryTreeQueue_DECLARE() \ 86 | __strong CHBinaryTreeNode** queue; \ 87 | NSUInteger queueCapacity, queueHead, queueTail 88 | 89 | #define CHBinaryTreeQueue_INIT() { \ 90 | queueCapacity = 128; \ 91 | queue = NSAllocateCollectable(kCHPointerSize*queueCapacity, NSScannedOption); \ 92 | queueHead = queueTail = 0; \ 93 | } 94 | 95 | #define CHBinaryTreeQueue_FREE(queue) { \ 96 | if (queue != NULL && kCHGarbageCollectionNotEnabled) \ 97 | free(queue); \ 98 | queue = NULL; \ 99 | } 100 | 101 | // This queue is a circular array, so resizing it takes a little extra care. 102 | #define CHBinaryTreeQueue_ENQUEUE(node) { \ 103 | queue[queueTail++] = node; \ 104 | queueTail %= queueCapacity; \ 105 | if (queueHead == queueTail) { \ 106 | queue = NSReallocateCollectable(queue, kCHPointerSize*queueCapacity*2, NSScannedOption); \ 107 | /* Copy wrapped-around portion to end of queue and move tail index */ \ 108 | objc_memmove_collectable(queue+queueCapacity, queue, kCHPointerSize*queueTail); \ 109 | /* Zeroing out shifted memory can simplify debugging queue problems */ \ 110 | /*bzero(queue, kCHPointerSize*queueTail);*/ \ 111 | queueTail += queueCapacity; \ 112 | queueCapacity *= 2; \ 113 | } \ 114 | } 115 | 116 | // Due to limitations of using macros, you must always call FRONT, then DEQUEUE. 117 | #define CHBinaryTreeQueue_FRONT \ 118 | ((queueHead != queueTail) ? queue[queueHead] : NULL) 119 | 120 | #define CHBinaryTreeQueue_DEQUEUE() \ 121 | if (queueHead != queueTail) queueHead = (queueHead + 1) % queueCapacity 122 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHAbstractBinarySearchTree.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHAbstractBinarySearchTree.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHSearchTree.h" 14 | 15 | /** 16 | @file CHAbstractBinarySearchTree.h 17 | An abstract CHSearchTree implementation with many default method implementations. 18 | */ 19 | 20 | /** 21 | A node used by binary search trees for internal storage and representation. 22 | 23 |
 24 |     typedef struct CHBinaryTreeNode {
 25 |         id object;
 26 |         union {
 27 |             struct {
 28 |                 __strong struct CHBinaryTreeNode *left;
 29 |                 __strong struct CHBinaryTreeNode *right;
 30 |             };
 31 |             __strong struct CHBinaryTreeNode *link[2];
 32 |         };
 33 |         union {
 34 |               int32_t balance;   // Used by CHAVLTree
 35 |             u_int32_t color;     // Used by CHRedBlackTree
 36 |             u_int32_t level;     // Used by CHAnderssonTree
 37 |             u_int32_t priority;  // Used by CHTreap
 38 |         };
 39 |     } CHBinaryTreeNode;
40 | 41 | The nested anonymous union and structs are to provide flexibility for dealing with various types of trees and access. (For those not familiar, a union is a data structure in which all members are stored at the same memory location, and can take on the value of any of its fields. A union occupies only as much space as the largest member, whereas a struct requires space equal to at least the sum of the size of its members.) 42 | 43 | - The first union provides two equivalent ways to access child nodes, based on what is most convenient and efficient. Because of the order in which the fields are declared, left === link[0] and right === link[1], meaning these respective pairs point to the same memory address. (This technique is an adaptation of the idiom used in the BST tutorials on EternallyConfuzzled.com.) 44 | - The second union allows balanced trees to store extra data at each node, while using the field name and type that makes sense for its algorithms. This allows for generic reuse while promoting meaningful semantics and preserving space. These fields use 32-bit-only types since we don't need extra space in 64-bit mode. 45 | 46 | Since CHUnbalancedTree doesn't store any extra data, the second union is essentially 4 bytes of pure overhead per node. However, since unbalanced trees are generally not a good choice for sorting large data sets anyway, this is largely a moot point. 47 | */ 48 | typedef struct CHBinaryTreeNode { 49 | id object; ///< The object stored in the node. 50 | union { 51 | struct { 52 | __strong struct CHBinaryTreeNode *left; ///< Link to left child. 53 | __strong struct CHBinaryTreeNode *right; ///< Link to right child. 54 | }; 55 | __strong struct CHBinaryTreeNode *link[2]; ///< Links to both childen. 56 | }; 57 | union { 58 | int32_t balance; // Used by CHAVLTree 59 | u_int32_t color; // Used by CHRedBlackTree 60 | u_int32_t level; // Used by CHAnderssonTree 61 | u_int32_t priority; // Used by CHTreap 62 | }; 63 | } CHBinaryTreeNode; 64 | // NOTE: If the compiler issues "Declaration does not declare anthing" warnings for this struct, change the C Language Dialect in your Xcode build settings to GNU99; anonymous structs and unions are not properly supported by the C99 standard. 65 | 66 | /** 67 | An abstract CHSearchTree with many default method implementations. Methods for search, size, and enumeration are implemented in this class, as are methods for NSCoding, NSCopying, and NSFastEnumeration. (This works since all child classes use the CHBinaryTreeNode struct.) Any subclass @b must implement \link #addObject: -addObject:\endlink and \link #removeObject: -removeObject:\endlink according to the inner workings of that specific tree. 68 | 69 | Rather than enforcing that this class be abstract, the contract is implied. If this class were actually instantiated, it would be of little use since there is attempts to insert or remove will result in runtime exceptions being raised. 70 | 71 | Much of the code and algorithms was distilled from information in the Binary Search Trees tutorial, which is in the public domain courtesy of Julienne Walker. Method names have been changed to match the APIs of existing Cocoa collections provided by Apple. 72 | */ 73 | @interface CHAbstractBinarySearchTree : NSObject 74 | { 75 | __strong CHBinaryTreeNode *header; // Dummy header; no more checks for root. 76 | __strong CHBinaryTreeNode *sentinel; // Dummy leaf; no more checks for NULL. 77 | NSUInteger count; // The number of objects currently in the tree. 78 | unsigned long mutations; // Tracks mutations for NSFastEnumeration. 79 | } 80 | 81 | /** 82 | Produces a representation of the receiver that can be useful for debugging. 83 | 84 | Whereas @c -description outputs only the contents of the tree in ascending order, this method outputs the internal structure of the tree (showing the objects in each node and its children) using a pre-order traversal. Sentinel leaf nodes are represented as @c nil children. 85 | 86 | @return A string representation of the receiver, intended for debugging purposes. 87 | 88 | @note Using @c print-object or @c po within GDB automatically calls the @c -debugDescription method of the specified object. 89 | 90 | @see dotGraphString 91 | */ 92 | - (NSString*) debugDescription; 93 | 94 | /** 95 | Produces a DOT language graph description for the receiver tree. 96 | 97 | A DOT graph can be rendered with GraphViz, OmniGraffle, or other similar tools. Sentinel leaf nodes are represented by a small black dot. 98 | 99 | @return A graph description for the receiver tree in the DOT language. 100 | 101 | @see debugDescription 102 | */ 103 | - (NSString*) dotGraphString; 104 | 105 | @end 106 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHTreap.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHTreap.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHAbstractBinarySearchTree.h" 14 | 15 | /** 16 | @file CHTreap.h 17 | A Treap implementation of CHSearchTree. 18 | */ 19 | 20 | /** 21 | A Treap, a balanced binary tree with O(log n) access in general, and improbable worst cases. The name "treap" is a portmanteau of "tree" and "heap", which is fitting since treaps exhibit properties of both binary search trees and heaps. 22 | 23 | Each node in a treap contains an object and a priority value, which may be arbitrarily-selected. Nodes in a treap are arranged such that the objects are ordered as in a binary search tree, and the priorities are ordered to obey the heap property (every node must have a higher priority than both its children). A sample treap is presented below, with priorities shown below the nodes. 24 | 25 | @image html treap-sample.png "Figure 1 - A sample treap with node priorities." 26 | 27 | Notice that, unlike a binary heap, a treap need not be a complete tree, which is a tree where every level is complete, with the possible exception of the lowest level, in which case any gaps must occur only on the level's right side. Also, the priority can be any numerical value (integer or floating point, positive or negative, signed or unsigned) as long as the range is large enough to accommodate the number of objects that may be added to the treap. Uniqueness of priority values is not strictly required, but it can help. 28 | 29 | Nodes are reordered to satisfy the heap property using rotations involving only two nodes, which change the position of children in the tree, but leave the subtrees unchanged. The rotation operations are mirror images of each other, and are shown below: 30 | 31 | @image html treap-rotations.png "Figure 2 - The effect of rotation operations." 32 | 33 | Since subtrees may be rotated to satisfy the heap property without violating the BST property, these two properties never conflict. In fact, for a given set of objects and unique priorities, there is only one treap structure that can satisfy both properties. In practice, when the priority for each node is truly random, the tree is relatively well balanced, with expected height of Θ(log n). Treap performance is extremely fast on average, with a small risk of slow performance in random worst cases, which tend to be quite rare in practice. 34 | 35 | Insertion is a cross between standard BST insertion and heap insertion: a new leaf node is created in the appropriate sorted location, and a random value is assigned. The path back to the root is then retraced, rotating the node upward as necessary until the new node's priority is greater than both its children's. Deletion is generally implemented by rotating the node to be removed down the tree until it becomes a leaf and can be clipped. At each rotation, the child whose priority is higher is rotated to become the root, and the node to delete descends the opposite subtree. (It is also possible to swap with the successor node as is common in BST deletion, but in order to preserve the tree's balance, the priorities should also be swapped, and the successor be bubbled up until the heap property is again satisfied, an approach quite similar to insertion.) 36 | 37 | This treap implementation adds two methods to those in the CHSearchTree protocol: 38 | - \link #addObject:withPriority: -addObject:withPriority:\endlink 39 | - \link #priorityForObject: -priorityForObject:\endlink 40 | 41 | Treaps were originally described in the following paper: 42 | 43 |
44 | R. Seidel and C. R. Aragon. "Randomized Search Trees." Algorithmica, 16(4/5):464-497, 1996. 45 |
46 | 47 | (See PDF original 48 | or PostScript revision) 49 | 50 | @todo Examine performance issues (treaps are often the slowest balanced tree). 51 | */ 52 | @interface CHTreap : CHAbstractBinarySearchTree 53 | 54 | /** Priority when an object is not found in a treap (max value for u_int32_t). */ 55 | #define CHTreapNotFound UINT32_MAX 56 | 57 | /** 58 | Add an object to the tree with a randomly-generated priority value. This encourages (but doesn't necessarily guarantee) well-balanced treaps. Random numbers are generated using @c arc4random and cast as an NSUInteger. 59 | 60 | @param anObject The object to add to the treap. 61 | 62 | @throw NSInvalidArgumentException if @a anObject is @c nil. 63 | 64 | @see #addObject:withPriority: 65 | */ 66 | - (void) addObject:(id)anObject; 67 | 68 | /** 69 | Add an object to the treap using a given priority value. Ordering is based on an object's response to the @c -compare: message. Since no duplicates are allowed, if the tree already contains an object for which @c compare: returns @c NSOrderedSame, that object is released and replaced by @a anObject. 70 | 71 | @param anObject The object to add to the treap. 72 | @param priority The priority to assign to @a nObject. Higher values percolate to the top. 73 | @note Although @a priority is typed as NSUInteger (consistent with Foundation APIs), \link CHBinaryTreeNode CHBinaryTreeNode->priority\endlink is typed as @c u_int32_t, so the value stored is actually priority % CHTreapNotFound. 74 | 75 | @throw NSInvalidArgumentException if @a anObject is @c nil. 76 | 77 | If @a anObject already exists in the treap, @a priority replaces the existing priority, and the existing node is percolated up or down to maintain the heap property. Thus, this method can be used to manipulate the depth of an object. Using a specific priority value for an object allows the user to impose a heap ordering by giving higher priorities to objects that should bubble towards the top, and lower priorities to objects that should bubble towards the bottom. In theory, this makes it significantly faster to retrieve commonly searched-for items, at the possible cost of a less-balanced treap overall, depending on the mapping of priorities and the sorted order of the objects. Use with caution. 78 | */ 79 | - (void) addObject:(id)anObject withPriority:(NSUInteger)priority; 80 | 81 | /** 82 | Returns the priority for @a anObject if it's in the treap, @c CHTreapNotFound otherwise. 83 | 84 | @param anObject The object for which to find the treap priority, if it exists. 85 | @return The priority for @a anObject if it is in the treap, @c CHTreapNotFound if it is @c nil or not present. 86 | */ 87 | - (NSUInteger) priorityForObject:(id)anObject; 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHMultiDictionary.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHMultiDictionary.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHMutableDictionary.h" 14 | 15 | /** 16 | @file CHMultiDictionary.h 17 | 18 | A multimap in which multiple values may be associated with a given key. 19 | */ 20 | 21 | /** 22 | A multimap implementation, in which multiple values may be associated with a given key. 23 | 24 | A map is the same as a "dictionary", "associative array", etc. and consists of a unique set of keys and a collection of values. In a standard map, each key is associated with one value; in a multimap, more than one value may be associated with a given key. A multimap is appropriate for any situation in which one item may correspond to (map to) multiple values, such as a term in an book index and occurrences of that term, courses for which a student is registered, etc. 25 | 26 | The values for a key may or may not be ordered. This implementation does not maintain an ordering for objects associated with a key, nor does it allow for multiple occurrences of an object associated with the same key. Internally, this class uses an NSMutableDictionary, and the associated values for each key are stored in distinct NSMutableSet instances. (Just as with NSDictionary, each key added to a CHMultiDictionary is copied using \link NSCopying#copyWithZone: -copyWithZone:\endlink and all keys must conform to the NSCopying protocol.) Objects are retained on insertion and released on removal or deallocation. 27 | 28 | Since NSDictionary and NSSet conform to the NSCoding protocol, any internal data can be serialized. However, NSSet cannot automatically be written to or read from a property list, since it has no specified order. Thus, instances of CHMultiDictionary must be encoded as an NSData object before saving to disk. 29 | 30 | Currently, this implementation does not support key-value coding, observing, or binding like NSDictionary does. Consequently, the distinction between "object" and "value" is blurrier, although hopefully consistent with the Cocoa APIs in general.... 31 | 32 | Unlike NSDictionary and other Cocoa collections, CHMultiDictionary has not been designed with mutable and immutable variants. A multimap is not that much more useful if it is immutable, so any copies made of this class are mutable by definition. 33 | */ 34 | @interface CHMultiDictionary : CHMutableDictionary { 35 | NSUInteger objectCount; // Number of objects currently in the dictionary. 36 | } 37 | 38 | #pragma mark Querying Contents 39 | 40 | /** 41 | Returns the number of objects in the receiver, associated with any key. 42 | 43 | @return The number of objects in the receiver. This is the sum total of objects associated with each key in the dictonary. 44 | 45 | @see allObjects 46 | */ 47 | - (NSUInteger) countForAllKeys; 48 | 49 | /** 50 | Returns the number of objects associated with a given key. 51 | 52 | @param aKey The key for which to return the object count. 53 | @return The number of objects associated with a given key in the dictionary. 54 | 55 | @see objectsForKey: 56 | */ 57 | - (NSUInteger) countForKey:(id)aKey; 58 | 59 | /** 60 | Returns an array of objects associated with a given key. 61 | 62 | @param aKey The key for which to return the corresponding objects. 63 | @return An NSSet of objects associated with a given key, or nil if the key is not in the receiver. 64 | 65 | @see countForKey: 66 | @see removeObjectsForKey: 67 | */ 68 | - (NSSet*) objectsForKey:(id)aKey; 69 | 70 | #pragma mark Modifying Contents 71 | 72 | /** 73 | Adds a given object to an entry for a given key in the receiver. 74 | 75 | @param aKey The key with which to associate @a anObject. 76 | @param anObject An object to add to an entry for @a aKey in the receiver. If an entry for @a aKey already exists in the receiver, @a anObject is added using \link NSMutableSet#addObject: -[NSMutableSet addObject:]\endlink, otherwise a new entry is created. 77 | 78 | @throw NSInvalidArgumentException if @a aKey or @a anObject is @c nil. 79 | 80 | @see addObjects:forKey: 81 | @see objectsForKey: 82 | @see removeObjectsForKey: 83 | @see setObjects:forKey: 84 | */ 85 | - (void) addObject:(id)anObject forKey:(id)aKey; 86 | 87 | /** 88 | Adds the given object(s) to a key entry in the receiver. 89 | 90 | @param aKey The key with which to associate @a anObject. 91 | @param objectSet A set of objects to add to an entry for @a aKey in the receiver. If an entry for @a aKey already exists in the receiver, @a anObject is added using \link NSMutableSet#unionSet: -[NSMutableSet unionSet:]\endlink, otherwise a new entry is created. 92 | 93 | @throw NSInvalidArgumentException if @a aKey or @a objectSet is @c nil. 94 | 95 | @see addObject:forKey: 96 | @see objectsForKey: 97 | @see removeObjectsForKey: 98 | @see setObjects:forKey: 99 | */ 100 | - (void) addObjects:(NSSet*)objectSet forKey:(id)aKey; 101 | 102 | /** 103 | Remove @b all occurrences of @a anObject associated with a given key. 104 | 105 | @param aKey The key for which to remove an entry. 106 | @param anObject An object (possibly) associated with @a aKey in the receiver. Objects are considered to be equal if -compare: returns NSOrderedSame. 107 | 108 | @throw NSInvalidArgumentException if @a aKey or @a anObject is @c nil. 109 | 110 | If @a aKey does not exist in the receiver, or if @a anObject is not associated with @a aKey, the contents of the receiver are not modified. 111 | 112 | @see containsObject 113 | @see objectsForKey: 114 | @see removeObjectsForKey: 115 | */ 116 | - (void) removeObject:(id)anObject forKey:(id)aKey; 117 | 118 | /** 119 | Remove a given key and its associated value(s) from the receiver. 120 | 121 | @param aKey The key for which to remove an entry. 122 | 123 | If @a aKey does not exist in the receiver, there is no effect on the receiver. 124 | 125 | @see objectsForKey: 126 | @see removeObject:forKey: 127 | */ 128 | - (void) removeObjectsForKey:(id)aKey; 129 | 130 | /** 131 | Sets the object(s) associated with a key entry in the receiver. 132 | 133 | @param aKey The key with which to associate the objects in @a objectSet. 134 | @param objectSet A set of objects to associate with @a key. If @a objectSet is empty, the contents of the receiver are not modified. If an entry for @a key already exists in the receiver, @a objectSet is added using \link NSMutableSet#setSet: -[NSMutableSet setSet:]\endlink, otherwise a new entry is created. 135 | 136 | @throw NSInvalidArgumentException if @a aKey or @a objectSet is @c nil. 137 | 138 | @see addObject:forKey: 139 | @see addObjects:forKey: 140 | @see objectsForKey: 141 | @see removeObjectsForKey: 142 | */ 143 | - (void) setObjects:(NSSet*)objectSet forKey:(id)aKey; 144 | 145 | @end 146 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHSearchTree.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHSearchTree.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | Copyright (c) 2002, Phillip Morelock 6 | 7 | This source code is released under the ISC License. 8 | 9 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 10 | 11 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 12 | */ 13 | 14 | #import "CHSortedSet.h" 15 | 16 | /** 17 | @file CHSearchTree.h 18 | 19 | A protocol which specifes an interface for N-ary search trees. 20 | */ 21 | 22 | /** 23 | A set of constant values denoting the order in which to traverse a tree structure. For details, see: http://en.wikipedia.org/wiki/Tree_traversal#Traversal_methods 24 | */ 25 | typedef enum { 26 | CHTraverseAscending, ///< Visit left subtree, node, then right subtree. 27 | CHTraverseDescending, ///< Visit right subtree, node, then left subtree. 28 | CHTraversePreOrder, ///< Visit node, left subtree, then right subtree. 29 | CHTraversePostOrder, ///< Visit left subtree, right subtree, then node. 30 | CHTraverseLevelOrder ///< Visit nodes from left-right, top-bottom. 31 | } CHTraversalOrder; 32 | 33 | #define isValidTraversalOrder(o) (o>=CHTraverseAscending && o<=CHTraverseLevelOrder) 34 | 35 | /** 36 | A protocol which specifes an interface for search trees, such as standard binary trees, B-trees, N-ary trees, or any similar tree-like structure. This protocol extends the CHSortedSet protocol with two additional methods (\link #allObjectsWithTraversalOrder:\endlink and \link #objectEnumeratorWithTraversalOrder:\endlink) specific to search tree implementations of a sorted set. 37 | 38 | Trees have a hierarchical structure and make heavy use of pointers to child nodes to organize information. There are several methods for visiting each node in a tree data structure, known as tree traversal techniques. (Traversal applies to N-ary trees, not just binary trees.) Whereas linked lists and arrays have one or two logical means of stepping through the elements, because trees are branching structures, there are many different ways to choose how to visit all of the nodes. There are 5 most commonly-used tree traversal methods (4 are depth-first, 1 is breadth-first) which are shown below. Table 1 shows the results enumerating the nodes in Figure 1 using each traversal and includes the constant associated with each. These constants can be passed to \link #allObjectsWithTraversalOrder:\endlink or \link #objectEnumeratorWithTraversalOrder:\endlink to enumerate objects from a search tree in a specified order. (Both \link #allObjects\endlink and \link #objectEnumerator\endlink use @c CHTraverseAscending; \link #reverseObjectEnumerator\endlink uses @c CHTraverseDescending.) 39 | 40 | 41 | 42 | 45 | 60 |
43 | @image html tree-traversal.png "Figure 1 — A sample binary search tree." 44 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 |
Traversal Visit Order Node Ordering CHTraversalOrder
In-order L, node, R A B C D E F G H I CHTraverseAscending
Reverse-order R, node, L I H G F E D C B A CHTraverseDescending
Pre-order node, L, R F B A D C E G I H CHTraversePreOrder
Post-order L, R, node A C E D B H I G F CHTraversePostOrder
Level-order L→R, T→B F B G A D I C E H CHTraverseLevelOrder
57 |

Table 1 - Various traversals as performed on the tree in Figure 1.

58 | 59 |
61 | 62 | */ 63 | @protocol CHSearchTree 64 | 65 | /** 66 | Initialize a search tree with no objects. 67 | 68 | @return An initialized search tree that contains no objects. 69 | 70 | @see initWithArray: 71 | */ 72 | - (id) init; 73 | 74 | /** 75 | Initialize a search tree with the contents of an array. Objects are added to the tree in the order they occur in the array. 76 | 77 | @param anArray An array containing objects with which to populate a new search tree. 78 | @return An initialized search tree that contains the objects in @a anArray in sorted order. 79 | */ 80 | - (id) initWithArray:(NSArray*)anArray; 81 | 82 | #pragma mark Querying Contents 83 | /** @name Tree Traversals */ 84 | // @{ 85 | 86 | /** 87 | Returns an NSArray which contains the objects in this tree in a given ordering. The object traversed last will appear last in the array. 88 | 89 | @param order The traversal order to use for enumerating the given tree. 90 | @return An array containing the objects in this tree. If the tree is empty, the array is also empty. 91 | 92 | @see \link allObjects - allObjects\endlink 93 | @see objectEnumeratorWithTraversalOrder: 94 | @see \link reverseObjectEnumerator - reverseObjectEnumerator\endlink 95 | */ 96 | - (NSArray*) allObjectsWithTraversalOrder:(CHTraversalOrder)order; 97 | 98 | /** 99 | Compares the receiving search tree to another search tree. Two search trees have equal contents if they each hold the same number of objects and objects at a given position in each search tree satisfy the \link NSObject-p#isEqual: -isEqual:\endlink test. 100 | 101 | @param otherTree A search tree. 102 | @return @c YES if the contents of @a otherTree are equal to the contents of the receiver, otherwise @c NO. 103 | */ 104 | - (BOOL) isEqualToSearchTree:(id)otherTree; 105 | 106 | /** 107 | Returns an enumerator that accesses each object using a given traversal order. 108 | 109 | @param order The order in which an enumerator should traverse nodes in the tree. @return An enumerator that accesses each object in the tree in a given order. The enumerator returned is never @c nil; if the tree is empty, the enumerator will always return @c nil for \link NSEnumerator#nextObject -nextObject\endlink and an empty array for \link NSEnumerator#allObjects -allObjects\endlink. 110 | 111 | @attention The enumerator retains the collection. Once all objects in the enumerator have been consumed, the collection is released. 112 | @warning Modifying a collection while it is being enumerated is unsafe, and may cause a mutation exception to be raised. 113 | 114 | @see allObjectsWithTraversalOrder: 115 | @see \link objectEnumerator - objectEnumerator\endlink 116 | @see \link reverseObjectEnumerator - reverseObjectEnumerator\endlink 117 | */ 118 | - (NSEnumerator*) objectEnumeratorWithTraversalOrder:(CHTraversalOrder)order; 119 | 120 | // @} 121 | @end 122 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHBidirectionalDictionary.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHBidirectionalDictionary.h 3 | 4 | Copyright (c) 2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHMutableDictionary.h" 14 | 15 | /** 16 | A dictionary that allows bidirectional lookup by keys and values with equal ease. This is possible because a bidirectional dictionary enforces the restriction that there is a 1-to-1 relation between keys and values, meaning that multiple keys cannot map to the same value. This is accomplished using a second internal dictionary which stores value-to-key mappings so values can be checked for uniqueness upon insertion. (Since values become the keys in this secondary dictionary, values must also be unique.) See \link #setObject:forKey: -setObject:forKey:\endlink below for details. 17 | 18 | The main purpose of this constraint is to make it trivial to do bidirectional lookups of one-to-one relationships. A trivial example might be to store husband-wife pairs and look up by either, rather than choosing only one. 19 | 20 | There are two simple ways (equivalent in performance) to look up a key by it's value: 21 | - Call \link #keyForObject: -keyForObject:\endlink on a bidirectional dictionary. 22 | - Acquire the inverse dictionary via \link #inverseDictionary -inverseDictionary\endlink, then call \link #setObject:forKey: -objectForKey:\endlink on that. 23 | 24 | @attention Since values are used as keys in the inverse dictionary, both keys and values must conform to the NSCopying protocol. (NSDictionary requires that keys conform to NSCopying, but not values.) If they don't, a crash will result when this collection attempts to copy them. 25 | 26 | @warning If a dictionary is passed to \link NSDictionary#initWithDictionary: -initWithDictionary:\endlink which maps the same value to multiple keys, the value will be mapped to whichever key mapped to that value is enumerated last. Depending on the specifics of the dictionary, this ordering may be arbitrary. 27 | 28 | Implementations of bidirectional dictionaries (aka "maps") in other languages include the following: 29 | 30 | - BiMap / BidiMap (Java) 31 | - Boost.Bimap / bimap (C++) 32 | - BiDirHashtable (C#) 33 | */ 34 | @interface CHBidirectionalDictionary : CHMutableDictionary { 35 | __strong CFMutableDictionaryRef objectsToKeys; // Used for reverse mapping. 36 | CHBidirectionalDictionary* inverse; // Pointer to inverse dictionary. 37 | } 38 | 39 | #pragma mark Querying Contents 40 | /** @name Querying Contents */ 41 | // @{ 42 | 43 | /** 44 | Returns the key associated with a given value. 45 | 46 | @param anObject The value for which to return the corresponding key. 47 | @return The key associated with @a value, or @c nil if no such key exists. 48 | 49 | @see \link NSDictionary#allKeys -allKeys\endlink 50 | @see \link NSDictionary#objectForKey: -objectForKey:\endlink 51 | @see removeKeyForObject: 52 | */ 53 | - (id) keyForObject:(id)anObject; 54 | 55 | /** 56 | Returns the inverse view of the receiver, which maps each value to its associated key. The receiver and its inverse are backed by the same data; any changes to one will appear in the other. A reference to the inverse (if one exists) is stored internally, and vice versa, so the two instances are linked. If one is released, it will cut its ties to and from the other. 57 | 58 | @return The inverse view of the receiver, 59 | 60 | @attention There is no guaranteed correspondence between the order in which keys are enumerated for a dictionary and its inverse. 61 | */ 62 | - (CHBidirectionalDictionary*) inverseDictionary; 63 | 64 | // @} 65 | #pragma mark Modifying Contents 66 | /** @name Modifying Contents */ 67 | // @{ 68 | 69 | /** 70 | Adds the entries from another dictionary to the receiver. Keys and values are copied as described in #setObject:forKey: below. If a key or value already exists in the receiver, the existing key-value mapping is replaced. 71 | 72 | @param otherDictionary The dictionary from which to add entries. All its keys @b and values must conform to the NSCopying protocol. 73 | 74 | @attention If @a otherDictionary maps the same value to multiple keys, the value can only appear once in the receiver, and will be mapped to the key that is enumerated @b last, which may be arbitrary. However, if @a otherDictionary is also a CHBidirectionalDictionary, the results will always be deterministic. 75 | 76 | @see \link NSDictionary#initWithDictionary: -initWithDictionary:\endlink 77 | @see setObject:forKey: 78 | */ 79 | - (void) addEntriesFromDictionary:(NSDictionary*)otherDictionary; 80 | 81 | /** 82 | Removes the key for a given value (and its inverse key-value mapping) from the receiver. Does nothing if the specified value doesn't exist. 83 | 84 | @param anObject The value to remove. 85 | 86 | @throw NSInvalidArgumentException if @a anObject is @c nil. 87 | 88 | @see keyForObject: 89 | @see removeObjectForKey: 90 | */ 91 | - (void) removeKeyForObject:(id)anObject; 92 | 93 | /** 94 | Removes the value for a given key (and its inverse value-key mapping) from the receiver. Does nothing if the specified key doesn't exist. 95 | 96 | @param aKey The key to remove. 97 | 98 | @throw NSInvalidArgumentException if @a aKey is @c nil. 99 | 100 | @see \link NSDictionary#objectForKey: -objectForKey:\endlink 101 | @see removeKeyForObject: 102 | */ 103 | - (void) removeObjectForKey:(id)aKey; 104 | 105 | /** 106 | Adds a given key-value pair to the receiver, replacing any existing pair with the given key or value. 107 | 108 | @param anObject The value for @a aKey. The object is copied, so it @b must conform to the NSCopying protocol or a crash will result. 109 | @param aKey The key for @a anObject. The key is copied, so it @b must conform to the NSCopying protocol or a crash will result. 110 | 111 | @throw NSInvalidArgumentException if @a aKey or @a anObject is @c nil. If you need to represent a nil value in the dictionary, use NSNull. 112 | 113 | @attention If @a aKey already exists in the receiver, the value previously associated with it is replaced by @a anObject, just as expected. However, if @a anObject already exists in the reciever with a different key, that mapping is removed to ensure that @a anObject only occurs once in the inverse dictionary. To check whether this will occur, call #keyForObject: first. 114 | 115 | @b Example: 116 | @code 117 | id dict = [[CHBidirectionalDictionary alloc] init]; 118 | [dict setObject:@"B" forKey:@"A"]; // now contains A -> B 119 | [dict setObject:@"C" forKey:@"A"]; // now contains A -> C 120 | [dict setObject:@"C" forKey:@"B"]; // now contains B -> C 121 | // Values must be unique just like keys, so A -> C is removed 122 | [dict setObject:@"D" forKey:@"A"]; // now contains B -> C, A -> D 123 | @endcode 124 | 125 | @see keyForObject: 126 | @see \link NSDictionary#objectForKey: -objectForKey:\endlink 127 | */ 128 | - (void) setObject:(id)anObject forKey:(id)aKey; 129 | 130 | // @} 131 | @end 132 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHHeap.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHHeap.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | Copyright (c) 2002, Phillip Morelock 6 | 7 | This source code is released under the ISC License. 8 | 9 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 10 | 11 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 12 | */ 13 | 14 | #import "Util.h" 15 | 16 | /** 17 | @file CHHeap.h 18 | 19 | A heap protocol, suitable for use with many variations of the heap structure. 20 | */ 21 | 22 | /** 23 | A heap protocol, suitable for use with many variations of the heap structure. 24 | 25 | Objects are "heapified" according to their sorted order, so they must respond to the @c -compare: selector, which accepts another object and returns @c NSOrderedAscending, @c NSOrderedSame, or @c NSOrderedDescending (constants in NSComparisonResult) as the receiver is less than, equal to, or greater than the argument, respectively. (Several Cocoa classes already implement the @c -compare: method, including NSString, NSDate, NSNumber, NSDecimalNumber, and NSCell.) 26 | 27 | @attention Due to the nature of a heap and how objects are stored internally, using NSFastEnumeration is not guaranteed to provide the objects in the order in which objects would be removed from the heap. If you want the objects to be sorted without removing them from the heap, use \link #allObjectsInSortedOrder allObjectsInSortedOrder\endlink instead. 28 | */ 29 | @protocol CHHeap 30 | 31 | /** 32 | Initialize a heap with ascending ordering and no objects. 33 | @return An initialized CHHeap that contains no objects and will sort in ascending order. 34 | 35 | @see initWithOrdering:array: 36 | */ 37 | - (id) init; 38 | 39 | /** 40 | Initialize a heap with ascending ordering and objects from a given array. Objects are added to the heap as they occur in the array, then "heapified" with an ordering of @c NSOrderedAscending. 41 | 42 | @param anArray An array containing objects with which to populate a new heap. 43 | @return An initialized CHHeap that contains the objects in @a anArray, to be sorted in ascending order. 44 | 45 | @see initWithOrdering:array: 46 | */ 47 | - (id) initWithArray:(NSArray*)anArray; 48 | 49 | /** 50 | Initialize a heap with a given sort ordering and no objects. 51 | 52 | @param order The sort order to use, either @c NSOrderedAscending or @c NSOrderedDescending. The root element of the heap will be the smallest or largest (according to the @c -compare: method), respectively. For any other value, an @c NSInvalidArgumentException is raised. 53 | @return An initialized CHHeap that contains no objects and will sort in the specified order. 54 | 55 | @see initWithOrdering:array: 56 | */ 57 | - (id) initWithOrdering:(NSComparisonResult)order; 58 | 59 | /** 60 | Initialize a heap with a given sort ordering and objects from a given array. Objects are added to the heap as they occur in the array, then "heapified" with an ordering of @a order. 61 | 62 | @param order The sort order to use, either @c NSOrderedAscending or @c NSOrderedDescending. The root element of the heap will be the smallest or largest (according to the @c -compare: method), respectively. For any other value, an @c NSInvalidArgumentException is raised. 63 | @param anArray An array containing objects with which to populate a new heap. 64 | @return An initialized CHHeap that contains the objects in @a anArray, to be sorted in the specified order. 65 | */ 66 | - (id) initWithOrdering:(NSComparisonResult)order array:(NSArray*)anArray; 67 | 68 | #pragma mark Querying Contents 69 | /** @name Querying Contents */ 70 | // @{ 71 | 72 | /** 73 | Returns an array containing the objects in this heap in sorted order. 74 | 75 | @return An array containing the objects in this heap in sorted order. If the heap is empty, the array is also empty. 76 | 77 | @attention Since only the first object in a heap is guaranteed to be in sorted order, this method incurs extra costs of (1) time for sorting the contents and (2) memory for storing an extra array. However, it does not affect the order of elements in the heap itself. 78 | 79 | @see count 80 | @see objectEnumerator 81 | */ 82 | - (NSArray*) allObjectsInSortedOrder; 83 | 84 | /** 85 | Determine whether the receiver contains a given object, matched using \link NSObject-p#isEqual: -isEqual:\endlink. 86 | 87 | @param anObject The object to test for membership in the heap. 88 | @return @c YES if @a anObject appears in the heap at least once, @c NO if @a anObject is @c nil or not present. 89 | 90 | @see removeObject: 91 | */ 92 | - (BOOL) containsObject:(id)anObject; 93 | 94 | /** 95 | Returns the number of objects currently in the heap. 96 | 97 | @return The number of objects currently in the heap. 98 | 99 | @see allObjectsInSortedOrder 100 | */ 101 | - (NSUInteger) count; 102 | 103 | /** 104 | Examine the first object in the heap without removing it. 105 | 106 | @return The first object in the heap, or @c nil if the heap is empty. 107 | 108 | @see removeFirstObject 109 | */ 110 | - (id) firstObject; 111 | 112 | /** 113 | Compares the receiving heap to another heap. Two heaps have equal contents if they each hold the same number of objects and (when fully sorted) objects at a given position in each heap satisfy the \link NSObject-p#isEqual: -isEqual:\endlink test. 114 | 115 | @param otherHeap A heap. 116 | @return @c YES if the contents of @a otherHeap are equal to the contents of the receiver, otherwise @c NO. 117 | */ 118 | - (BOOL) isEqualToHeap:(id)otherHeap; 119 | 120 | /** 121 | Returns an enumerator that accesses each object in the heap in sorted order. 122 | 123 | @return An enumerator that accesses each object in the heap in sorted order. The enumerator returned is never @c nil; if the heap is empty, the enumerator will always return @c nil for \link NSEnumerator#nextObject -nextObject\endlink and an empty array for \link NSEnumerator#allObjects -allObjects\endlink. 124 | 125 | @attention Since only the first object in a heap is guaranteed to be in sorted order, this method incurs extra costs of (1) time for sorting the contents and (2) memory for storing an extra array. However, it does not affect the order of elements in the heap itself. 126 | 127 | @note On platforms that support NSFastEnumeration, that construct will also enumerate objects in sorted order. 128 | 129 | @warning Modifying a collection while it is being enumerated is unsafe, and may cause a mutation exception to be raised. 130 | 131 | @see allObjectsInSortedOrder 132 | */ 133 | - (NSEnumerator*) objectEnumerator; 134 | 135 | // @} 136 | #pragma mark Modifying Contents 137 | /** @name Modifying Contents */ 138 | // @{ 139 | 140 | /** 141 | Insert a given object into the heap. 142 | 143 | @param anObject The object to add to the heap. 144 | 145 | @throw NSInvalidArgumentException if @a anObject is @c nil. 146 | 147 | @see addObjectsFromArray: 148 | */ 149 | - (void) addObject:(id)anObject; 150 | 151 | /** 152 | Adds the objects in a given array to the receiver, then re-establish the heap property. After all the objects have been inserted, objects are "heapified" as necessary, proceeding backwards from index @c count/2 down to @c 0. 153 | 154 | @param anArray An array of objects to add to the receiver. 155 | 156 | @see addObject: 157 | */ 158 | - (void) addObjectsFromArray:(NSArray*)anArray; 159 | 160 | /** 161 | Empty the receiver of all of its members. 162 | 163 | @see allObjectsInSortedOrder 164 | @see removeFirstObject 165 | */ 166 | - (void) removeAllObjects; 167 | 168 | /** 169 | Remove the front object in the heap; if it is already empty, there is no effect. 170 | 171 | @see firstObject 172 | @see removeAllObjects 173 | */ 174 | - (void) removeFirstObject; 175 | 176 | // @} 177 | @end 178 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHDataStructures.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHDataStructures.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import 14 | 15 | // Protocols 16 | #import "CHDeque.h" 17 | #import "CHHeap.h" 18 | #import "CHLinkedList.h" 19 | #import "CHQueue.h" 20 | #import "CHSearchTree.h" 21 | #import "CHSortedSet.h" 22 | #import "CHStack.h" 23 | 24 | // Concrete Implementations 25 | #import "CHAnderssonTree.h" 26 | #import "CHBidirectionalDictionary.h" 27 | #import "CHBinaryHeap.h" 28 | #import "CHAVLTree.h" 29 | #import "CHCircularBuffer.h" 30 | #import "CHCircularBufferDeque.h" 31 | #import "CHCircularBufferQueue.h" 32 | #import "CHCircularBufferStack.h" 33 | #import "CHDoublyLinkedList.h" 34 | #import "CHListDeque.h" 35 | #import "CHListQueue.h" 36 | #import "CHListStack.h" 37 | #import "CHMultiDictionary.h" 38 | #import "CHMutableArrayHeap.h" 39 | #import "CHOrderedDictionary.h" 40 | #import "CHOrderedSet.h" 41 | #import "CHRedBlackTree.h" 42 | #import "CHSinglyLinkedList.h" 43 | #import "CHSortedDictionary.h" 44 | #import "CHTreap.h" 45 | #import "CHUnbalancedTree.h" 46 | 47 | // Utilities 48 | #import "Util.h" 49 | 50 | /** 51 | @file CHDataStructures.h 52 | 53 | An umbrella header which imports all the public header files for the framework. Headers for individual classes have minimal dependencies, and they import any other header files they may require. For example, this header does not import any of the CHAbstract... header files (since only subclasses use them), but all such headers are still included with the framework. (The protocols for abstract data types are imported so clients can use protocol-typed variables if needed.) 54 | */ 55 | 56 | /** 57 | @mainpage Overview 58 | 59 | CHDataStructures.framework is an open-source library of standard data structures which can be used in any Objective-C program, for educational purposes or as a foundation for other data structures to build on. Data structures in this framework adopt Objective-C protocols that define the functionality of and API for interacting with any implementation thereof, regardless of its internals. 60 | 61 | Apple's extensive and flexible Cocoa frameworks include several collections classes that are highly optimized and amenable to many situations. However, sometimes an honest-to-goodness stack, queue, linked list, tree, etc. can greatly improve the clarity and comprehensibility of code. This framework provides Objective-C implementations of common data structures which are currently beyond the purview of Cocoa. 62 | 63 | The abstract data type protocols include: 64 | - CHDeque 65 | - CHHeap 66 | - CHLinkedList 67 | - CHQueue 68 | - CHSearchTree 69 | - CHSortedSet 70 | - CHStack 71 | 72 | The concrete child classes of NSMutableArray include: 73 | - CHCircularBuffer 74 | - CHCircularBufferDeque 75 | - CHCircularBufferQueue 76 | - CHCircularBufferStack 77 | - CHMutableArrayHeap 78 | 79 | The concrete child classes of NSMutableDictionary include: 80 | - CHMutableDictionary 81 | - CHBidirectionalDictionary 82 | - CHMultiDictionary 83 | - CHOrderedDictionary 84 | - CHSortedDictionary 85 | 86 | The concrete child classes of NSMutableSet include: 87 | - CHMutableSet 88 | - CHOrderedSet 89 | 90 | The code is written for Cocoa applications and does use some features of Objective-C 2.0, which is present in Mac OS X 10.5+ and all versions of iOS. Most of the code could be ported to other Objective-C environments (such as GNUStep) without too much trouble. However, such efforts would probably be better accomplished by forking this project rather than integrating with it, for several main reasons: 91 | 92 |
    93 |
  1. Supporting multiple environments increases code complexity, and consequently the effort required to test, maintain, and improve it.
  2. 94 |
  3. Libraries that have bigger and slower binaries to accommodate all possible platforms don't help the mainstream developer.
  4. 95 |
  5. Apple is the de facto custodian and strongest proponent of Objective-C, a trend which isn't likely to change soon.
  6. 96 |
97 | 98 | While certain implementations utilize straight C for their internals, this framework exposes fairly high-level APIs, and uses composition rather than inheritance wherever it makes sense. The framework was originally created as an exercise in writing Objective-C code and consisted mainly of ported Java code. In later revisions, performance has gained greater emphasis, but the primary motivation is to provide friendly, intuitive Objective-C interfaces for data structures, not to maximize speed at any cost, which sometimes happens with C++ and the STL. The algorithms should all be sound (i.e., you won't get O(n) performance where it should be O(log n) or O(1), etc.) and perform quite well in general. If your choice of data structure type and implementation are dependent on performance or memory usage, it would be wise to run the benchmarks from Xcode and choose based on the time and memory complexity for specific implementations. 99 | 100 | This framework is released under a variant of the ISC license, an extremely simple and permissive free software license (functionally equivalent to the MIT license and two-clause BSD license) approved by the Open Source Initiative (OSI) and recognized as GPL-compatible by the GNU Project. The license is included in every source file, and is reproduced in its entirety here: 101 | 102 |
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.
103 | 104 | Earlier versions of this framework were released under a copyleft license, which are generally unfriendly towards commercial software development. 105 | 106 | If you would like to contribute to the library or let me know that you use it, please email me. I am very receptive to help, criticism, flames, whatever. 107 | 108 | — Quinn Taylor 109 | 110 |
111 | 112 | @todo Add support for NSSortDescriptor for comparator-style sorting. (Currently, all implementations use -compare: for sorting.) 113 | 114 | @todo Consider implementing "versionable" persistent data structures, wherein concurrent enumeration and modification are supported via tagged versions of the structure. (An example of this for red-black trees is an exercise for the reader in "Introduction to Algorithms, 2nd Edition" (ISBN: 9780262032933) in problem 13.1, pages 294-295.) The best candidates are probably queues, heaps, and search trees (sorted sets). 115 | 116 | @todo Look at adding @c -filterUsingPredicate: to all data structures. This would allow applying an NSPredicate and removing only objects that don't match. Also add copying variants (@c -filteredQueueUsingPredicate:, @c -filteredSortedSetUsingPredicate:, etc.) to avoid the overhead of a full copy before filtering. 117 | 118 | @todo Examine feasibility and utility of implementing key-value observing/coding/binding. 119 | */ 120 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHOrderedSet.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHOrderedSet.h 3 | 4 | Copyright (c) 2009-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import "CHMutableSet.h" 14 | 15 | /** 16 | @file CHOrderedSet.h 17 | A set which also maintains order of insertion, including manual reordering. 18 | */ 19 | 20 | /** 21 | A set which also maintains order of insertion, including manual reordering. 22 | 23 | An ordered set is a composite data structure which combines a set and a list. It blends the uniqueness aspect of sets with the ability to recall the order in which items were added to the set. While this is possible with only a ordered set, the speedy test for membership is a set means that many basic operations (such as add, remove, and contains) that take linear time for a list can be accomplished in constant time (i.e. O(1) instead of O(n) complexity. Compared to these gains, the time overhead required for maintaining the list is negligible, although it does increase memory requirements. 24 | 25 | One of the most common implementations of an insertion-ordered set is Java's LinkedHashSet. This implementation wraps an NSMutableSet and a circular buffer to maintain insertion order. The API is designed to be as consistent as possible with that of NSSet and NSMutableSet. 26 | 27 | @see CHOrderedDictionary 28 | 29 | @todo Allow setting a maximum size, and either reject additions or evict the "oldest" item when the limit is reached? (Perhaps this would be better done by the user...) 30 | */ 31 | @interface CHOrderedSet : CHMutableSet { 32 | id ordering; // A structure for maintaining ordering of the objects. 33 | } 34 | 35 | #pragma mark Querying Contents 36 | /** @name Querying Contents */ 37 | // @{ 38 | 39 | /** 40 | Returns an array of the objects in the set, in the order in which they were inserted. 41 | 42 | @return An array of the objects in the set, in the order in which they were inserted. 43 | 44 | @see anyObject 45 | @see objectEnumerator 46 | */ 47 | - (NSArray*) allObjects; 48 | 49 | /** 50 | Returns the "oldest" member of the receiver. 51 | 52 | @return The "oldest" member of the receiver. 53 | 54 | @see addObject: 55 | @see anyObject 56 | @see lastObject 57 | @see removeFirstObject 58 | */ 59 | - (id) firstObject; 60 | 61 | /** 62 | Returns the index of a given object based on insertion order. 63 | 64 | @param anObject The object to search for in the receiver. 65 | @return The index of @a anObject based on insertion order. If the object does not existsin the receiver, @c NSNotFound is returned. 66 | 67 | @see firstObject 68 | @see lastObject 69 | @see objectAtIndex: 70 | @see removeObjectAtIndex: 71 | */ 72 | - (NSUInteger) indexOfObject:(id)anObject; 73 | 74 | /** 75 | Compares the receiving ordered set to another ordered set. Two ordered sets have equal contents if they each hold the same number of objects and objects at a given position in each ordered set satisfy the \link NSObject-p#isEqual: -isEqual:\endlink test. 76 | 77 | @param otherOrderedSet A ordered set. 78 | @return @c YES if the contents of @a otherOrderedSet are equal to the contents of the receiver, otherwise @c NO. 79 | */ 80 | - (BOOL) isEqualToOrderedSet:(CHOrderedSet*)otherOrderedSet; 81 | 82 | /** 83 | Returns the "youngest" member of the receiver. 84 | 85 | @return The object in the array with the highest index value. If the array is empty, returns nil. 86 | 87 | @see addObject: 88 | @see anyObject 89 | @see firstObject 90 | @see removeLastObject 91 | */ 92 | - (id) lastObject; 93 | 94 | /** 95 | Returns the value at the specified index. 96 | 97 | @param index The insertion-order index of the value to retrieve. 98 | @return The value at the specified index, based on insertion order. 99 | 100 | @throw NSRangeException if @a index exceeds the bounds of the receiver. 101 | 102 | @see indexOfObject: 103 | @see objectsAtIndexes: 104 | @see removeObjectAtIndex: 105 | */ 106 | - (id) objectAtIndex:(NSUInteger)index; 107 | 108 | /** 109 | Returns an enumerator object that lets you access each object in the receiver by insertion order. 110 | 111 | @return An enumerator object that lets you access each object in the receiver by insertion order. 112 | 113 | @warning Modifying a collection while it is being enumerated is unsafe, and may cause a mutation exception to be raised. 114 | 115 | If you need to modify the entries concurrently, you can enumerate over a "snapshot" of the set's values obtained from #allObjects. 116 | 117 | @see allObjects 118 | */ 119 | - (NSEnumerator*) objectEnumerator; 120 | 121 | /** 122 | Returns an array containing the objects in the receiver at the indexes specified by a given index set. 123 | 124 | @param indexes A set of positions corresponding to objects to retrieve from the receiver. 125 | @return A new array containing the objects in the receiver specified by @a indexes. 126 | 127 | @throw NSRangeException if any location in @a indexes exceeds the bounds of the receiver. 128 | @throw NSInvalidArgumentException if @a indexes is @c nil. 129 | 130 | @attention To retrieve objects in a given NSRange, pass [NSIndexSet indexSetWithIndexesInRange:range] as the parameter to this method. 131 | 132 | @see allObjects 133 | @see objectAtIndex: 134 | @see removeObjectsAtIndexes: 135 | */ 136 | - (NSArray*) objectsAtIndexes:(NSIndexSet*)indexes; 137 | 138 | /** 139 | Returns an ordered dictionary containing the objects in the receiver at the indexes specified by a given index set. 140 | 141 | @param indexes A set of indexes for keys to retrieve from the receiver. 142 | @return An array containing the objects in the receiver at the indexes specified by @a indexes. 143 | 144 | @throw NSRangeException if any location in @a indexes exceeds the bounds of the receiver. 145 | @throw NSInvalidArgumentException if @a indexes is @c nil. 146 | 147 | @attention To retrieve entries in a given NSRange, pass [NSIndexSet indexSetWithIndexesInRange:range] as the parameter. 148 | */ 149 | - (CHOrderedSet*) orderedSetWithObjectsAtIndexes:(NSIndexSet*)indexes; 150 | 151 | // @} 152 | #pragma mark Modifying Contents 153 | /** @name Modifying Contents */ 154 | // @{ 155 | 156 | /** 157 | Adds a given object to the receiver at a given index. If the receiver already contains an equivalent object, it is replaced with @a anObject. 158 | 159 | @param anObject The object to add to the receiver. 160 | @param index The index at which @a anObject should be inserted. 161 | 162 | @see addObject: 163 | @see indexOfObject: 164 | @see objectAtIndex: 165 | */ 166 | - (void) insertObject:(id)anObject atIndex:(NSUInteger)index; 167 | 168 | /** 169 | Exchange the objects in the receiver at given indexes. 170 | 171 | @param idx1 The index of the object to replace with the object at @a idx2. 172 | @param idx2 The index of the object to replace with the object at @a idx1. 173 | 174 | @throw NSRangeException if @a idx1 or @a idx2 exceeds the bounds of the receiver. 175 | 176 | @see indexOfObject: 177 | @see insertObject:atIndex: 178 | @see objectAtIndex: 179 | */ 180 | - (void) exchangeObjectAtIndex:(NSUInteger)idx1 withObjectAtIndex:(NSUInteger)idx2; 181 | 182 | /** 183 | Remove the "oldest" member of the receiver. 184 | 185 | @see firstObject 186 | @see removeAllObjects 187 | @see removeObject: 188 | @see removeObjectAtIndex: 189 | */ 190 | - (void) removeFirstObject; 191 | 192 | /** 193 | Remove the "youngest" member of the receiver. 194 | 195 | @see lastObject 196 | @see removeAllObjects 197 | @see removeObject: 198 | @see removeObjectAtIndex: 199 | */ 200 | - (void) removeLastObject; 201 | 202 | /** 203 | Remove the object at a given index from the receiver. 204 | 205 | @param index The index of the object to remove. 206 | 207 | @throw NSRangeException if @a index exceeds the bounds of the receiver. 208 | 209 | @see minusSet: 210 | @see objectAtIndex: 211 | @see removeAllObjects 212 | @see removeFirstObject 213 | @see removeLastObject 214 | @see removeObject: 215 | @see removeObjectsAtIndexes: 216 | */ 217 | - (void) removeObjectAtIndex:(NSUInteger)index; 218 | 219 | /** 220 | Remove the objects at the specified indexes from the receiver. 221 | @param indexes A set of positions corresponding to objects to remove from the receiver. 222 | 223 | @throw NSRangeException if any location in @a indexes exceeds the bounds of the receiver. 224 | @throw NSInvalidArgumentException if @a indexes is @c nil. 225 | 226 | @attention To remove objects in a given @c NSRange, pass [NSIndexSet indexSetWithIndexesInRange:range] as the parameter to this method. 227 | 228 | @see objectsAtIndexes: 229 | @see removeAllObjects 230 | @see removeObjectAtIndex: 231 | */ 232 | - (void) removeObjectsAtIndexes:(NSIndexSet*)indexes; 233 | 234 | // @} 235 | @end 236 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/Util.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- Util.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | 6 | This source code is released under the ISC License. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 9 | 10 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 11 | */ 12 | 13 | #import 14 | 15 | /** 16 | @file Util.h 17 | A group of utility C functions for simplifying common exceptions and logging. 18 | */ 19 | 20 | /** Macro for reducing visibility of symbol names not indended to be exported. */ 21 | #define HIDDEN __attribute__((visibility("hidden"))) 22 | 23 | /** Macro for designating symbols as being unused to suppress compile warnings. */ 24 | #define UNUSED __attribute__((unused)) 25 | 26 | #pragma mark - 27 | 28 | // NSInteger/NSUInteger are new in Leopard; define if on an earlier OS version. 29 | #ifndef NSINTEGER_DEFINED 30 | #if __LP64__ || NS_BUILD_32_LIKE_64 31 | typedef long NSInteger; 32 | typedef unsigned long NSUInteger; 33 | #else 34 | typedef int NSInteger; 35 | typedef unsigned int NSUInteger; 36 | #endif 37 | 38 | #define NSIntegerMax LONG_MAX 39 | #define NSIntegerMin LONG_MIN 40 | #define NSUIntegerMax ULONG_MAX 41 | 42 | #define NSINTEGER_DEFINED 1 43 | #endif 44 | 45 | #pragma mark - 46 | 47 | // For iOS, define enum and dummy functions used for Garbage Collection. 48 | #if (TARGET_OS_IPHONE || TARGET_OS_EMBEDDED || !TARGET_OS_MAC) 49 | 50 | enum { 51 | NSScannedOption = (1UL << 0), 52 | NSCollectorDisabledOption = (1UL << 1), 53 | }; 54 | 55 | void* __strong NSAllocateCollectable(NSUInteger size, NSUInteger options); 56 | 57 | void* __strong NSReallocateCollectable(void *ptr, NSUInteger size, NSUInteger options); 58 | 59 | #define objc_memmove_collectable memmove 60 | 61 | #else 62 | 63 | // This is declared in , but importing the header is overkill. 64 | HIDDEN void* objc_memmove_collectable(void *dst, const void *src, size_t size); 65 | 66 | #endif 67 | 68 | #pragma mark - 69 | 70 | /** Global variable to simplify checking if garbage collection is enabled. */ 71 | OBJC_EXPORT BOOL kCHGarbageCollectionNotEnabled; 72 | 73 | /** Global variable to store the size of a pointer only once. */ 74 | HIDDEN size_t kCHPointerSize; 75 | 76 | /** 77 | Simple function for checking object equality, to be used as a function pointer. 78 | 79 | @param o1 The first object to be compared. 80 | @param o2 The second object to be compared. 81 | @return [o1 isEqual:o2] 82 | */ 83 | HIDDEN BOOL objectsAreEqual(id o1, id o2); 84 | 85 | /** 86 | Simple function for checking object identity, to be used as a function pointer. 87 | 88 | @param o1 The first object to be compared. 89 | @param o2 The second object to be compared. 90 | @return o1 == o2 91 | */ 92 | HIDDEN BOOL objectsAreIdentical(id o1, id o2); 93 | 94 | /** 95 | Determine whether two collections enumerate the equivalent objects in the same order. 96 | 97 | @param collection1 The first collection to be compared. 98 | @param collection2 The second collection to be compared. 99 | @return Whether the collections are equivalent. 100 | 101 | @throw NSInvalidArgumentException if one of both of the arguments do not respond to the @c -count or @c -objectEnumerator selectors. 102 | */ 103 | OBJC_EXPORT BOOL collectionsAreEqual(id collection1, id collection2); 104 | 105 | /** 106 | Generate a hash for a collection based on the count and up to two objects. If objects are provided, the result of their -hash method will be used. 107 | 108 | @param count The number of objects in the collection. 109 | @param o1 The first object to include in the hash. 110 | @param o2 The second object to include in the hash. 111 | @return An unsigned integer that can be used as a table address in a hash table structure. 112 | */ 113 | HIDDEN NSUInteger hashOfCountAndObjects(NSUInteger count, id o1, id o2); 114 | 115 | #pragma mark - 116 | 117 | /** 118 | Convenience function for raising an exception for an invalid range (index). 119 | 120 | Currently, there is no support for calling this function from a C function. 121 | 122 | @param aClass The class object for the originator of the exception. Callers should pass the result of [self class] for this parameter. 123 | @param method The method selector where the problem originated. Callers should pass @c _cmd for this parameter. 124 | @param index The offending index passed to the receiver. 125 | @param elements The number of elements present in the receiver. 126 | 127 | @throw NSRangeException 128 | 129 | @see \link NSException#raise:format: +[NSException raise:format:]\endlink 130 | */ 131 | OBJC_EXPORT void CHIndexOutOfRangeException(Class aClass, SEL method, 132 | NSUInteger index, NSUInteger elements); 133 | 134 | /** 135 | Convenience function for raising an exception on an invalid argument. 136 | 137 | Currently, there is no support for calling this function from a C function. 138 | 139 | @param aClass The class object for the originator of the exception. Callers should pass the result of [self class] for this parameter. 140 | @param method The method selector where the problem originated. Callers should pass @c _cmd for this parameter. 141 | @param str An NSString describing the offending invalid argument. 142 | 143 | @throw NSInvalidArgumentException 144 | 145 | @see \link NSException#raise:format: +[NSException raise:format:]\endlink 146 | */ 147 | OBJC_EXPORT void CHInvalidArgumentException(Class aClass, SEL method, NSString *str); 148 | 149 | /** 150 | Convenience function for raising an exception on an invalid nil object argument. 151 | 152 | Currently, there is no support for calling this function from a C function. 153 | 154 | @param aClass The class object for the originator of the exception. Callers should pass the result of [self class] for this parameter. 155 | @param method The method selector where the problem originated. Callers should pass @c _cmd for this parameter. 156 | 157 | @throw NSInvalidArgumentException 158 | 159 | @see CHInvalidArgumentException() 160 | */ 161 | OBJC_EXPORT void CHNilArgumentException(Class aClass, SEL method); 162 | 163 | /** 164 | Convenience function for raising an exception when a collection is mutated. 165 | 166 | Currently, there is no support for calling this function from a C function. 167 | 168 | @param aClass The class object for the originator of the exception. Callers should pass the result of [self class] for this parameter. 169 | @param method The method selector where the problem originated. Callers should pass @c _cmd for this parameter. 170 | 171 | @throw NSGenericException 172 | 173 | @see \link NSException#raise:format: +[NSException raise:format:]\endlink 174 | */ 175 | OBJC_EXPORT void CHMutatedCollectionException(Class aClass, SEL method); 176 | 177 | /** 178 | Convenience function for raising an exception for un-implemented functionality. 179 | 180 | Currently, there is no support for calling this function from a C function. 181 | 182 | @param aClass The class object for the originator of the exception. Callers should pass the result of [self class] for this parameter. 183 | @param method The method selector where the problem originated. Callers should pass @c _cmd for this parameter. 184 | 185 | @throw NSInternalInconsistencyException 186 | 187 | @see \link NSException#raise:format: +[NSException raise:format:]\endlink 188 | */ 189 | OBJC_EXPORT void CHUnsupportedOperationException(Class aClass, SEL method); 190 | 191 | /** 192 | Provides a more terse alternative to NSLog() which accepts the same parameters. The output is made shorter by excluding the date stamp and process information which NSLog prints before the actual specified output. 193 | 194 | @param format A format string, which must not be nil. 195 | @param ... A comma-separated list of arguments to substitute into @a format. 196 | 197 | Read Formatting String Objects and String Format Specifiers on this webpage for details about using format strings. Look for examples that use @c NSLog() since the parameters and syntax are idential. 198 | */ 199 | OBJC_EXPORT void CHQuietLog(NSString *format, ...); 200 | 201 | /** 202 | A macro for including the source file and line number where a log occurred. 203 | 204 | @param format A format string, which must not be nil. 205 | @param ... A comma-separated list of arguments to substitute into @a format. 206 | 207 | This is defined as a compiler macro so it can automatically fill in the file name and line number where the call was made. After printing these values in brackets, this macro calls #CHQuietLog with @a format and any other arguments supplied afterward. 208 | 209 | @see CHQuietLog 210 | */ 211 | #ifndef CHLocationLog 212 | #define CHLocationLog(format,...) \ 213 | { \ 214 | NSString *file = [[NSString alloc] initWithUTF8String:__FILE__]; \ 215 | printf("[%s:%d] ", [[file lastPathComponent] UTF8String], __LINE__); \ 216 | [file release]; \ 217 | CHQuietLog((format),##__VA_ARGS__); \ 218 | } 219 | #endif 220 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/AddNoteViewController.m: -------------------------------------------------------------------------------- 1 | 2 | #import "AddNoteViewController.h" 3 | #import "ChecklistItem.h" 4 | 5 | #define emptyNoteAlertViewsTag 0 6 | 7 | @interface AddNoteViewController () 8 | 9 | @end 10 | 11 | 12 | 13 | @implementation AddNoteViewController { 14 | 15 | NSString *notes; 16 | BOOL shouldRemind; 17 | NSDate *dueDate; 18 | } 19 | 20 | 21 | 22 | ///synthesize properties 23 | @synthesize notesField, delegate, itemToEdit, dueDateLabel, activityViewController; 24 | 25 | 26 | 27 | ///we display current date and time when we present the addnotevewcontroller to user 28 | - (id)initWithCoder:(NSCoder *)aDecoder 29 | { 30 | if ((self = [super initWithCoder:aDecoder])) { 31 | notes = @""; 32 | shouldRemind = YES; 33 | dueDate = [NSDate date]; 34 | } 35 | return self; 36 | } 37 | 38 | 39 | 40 | /// NSdate formetter to format date and update the label when user picked different date 41 | - (void)updateDueDateLabel 42 | { 43 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 44 | [formatter setDateStyle:NSDateFormatterShortStyle]; 45 | [formatter setTimeStyle:NSDateFormatterShortStyle]; 46 | self.dueDateLabel.text = [formatter stringFromDate:dueDate]; 47 | } 48 | 49 | 50 | 51 | 52 | - (void)viewDidLoad 53 | { 54 | [super viewDidLoad]; 55 | 56 | ///wecreate 57 | UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] 58 | initWithBarButtonSystemItem:UIBarButtonSystemItemDone 59 | target:self 60 | action:@selector(done)]; 61 | 62 | UIBarButtonItem *shareButton = [[UIBarButtonItem alloc] 63 | initWithBarButtonSystemItem:UIBarButtonSystemItemAction 64 | target:self 65 | action:@selector(shareButtonClicked:)]; 66 | 67 | 68 | self.navigationItem.rightBarButtonItems = 69 | [NSArray arrayWithObjects:doneButton, shareButton, nil]; 70 | 71 | 72 | 73 | ///we check whether it is editing mode or adding mode, then set the title and fields appropriately. 74 | 75 | if (self.itemToEdit != nil) { 76 | self.title = @"Edit Note"; 77 | } else 78 | 79 | self.title = @"Add Note"; 80 | self.notesField.text = notes; 81 | 82 | 83 | [self updateDueDateLabel]; 84 | shareButton.enabled = YES; 85 | 86 | 87 | // Sets the TextView delegate 88 | self.notesField.delegate = self; 89 | 90 | 91 | 92 | 93 | [self customizeAppearance]; 94 | 95 | } 96 | 97 | 98 | 99 | - (void)viewWillAppear:(BOOL)animated 100 | { 101 | [super viewWillAppear:animated]; 102 | 103 | if (self.title != NSLocalizedString(@"Edit Note", nil)) { 104 | [self.notesField becomeFirstResponder]; 105 | [self.notesField resignFirstResponder]; 106 | // [self.notesField becomeFirstResponder]; 107 | 108 | }else 109 | [self.notesField resignFirstResponder]; 110 | } 111 | 112 | 113 | 114 | 115 | 116 | /// method to call addItemViewControllerDidCancel method when cancel button pressed 117 | 118 | - (IBAction)cancel 119 | { 120 | [self.delegate addItemViewControllerDidCancel:self]; 121 | } 122 | 123 | 124 | /// method to call didFinishAddingItem method when Done button pressed 125 | 126 | 127 | - (IBAction)done 128 | { 129 | 130 | if ([self.notesField.text isEqualToString:@" "] || [self.notesField.text isEqualToString:@""] || [self.notesField.text isEqualToString:nil]) 131 | { 132 | 133 | UIAlertView* message = [[UIAlertView alloc] 134 | initWithTitle: @"Empty !!!" 135 | message: @"Note is empty. Click OK to write again, or Cancel to dismiss." 136 | delegate: self 137 | cancelButtonTitle: @"Cancel" 138 | otherButtonTitles: @"OK", nil]; 139 | 140 | message.tag = emptyNoteAlertViewsTag; 141 | [message show]; 142 | 143 | } 144 | else 145 | { 146 | if (self.itemToEdit == nil) { 147 | ChecklistItem *item = [[ChecklistItem alloc] init]; 148 | 149 | item.notes = self.notesField.text; 150 | item.shouldRemind = YES; 151 | item.dueDate = dueDate; 152 | 153 | // Shows the notification on the given date 154 | // [item scheduleNotification]; 155 | 156 | [self.delegate addItemViewController:self didFinishAddingItem:item]; 157 | } else { 158 | self.itemToEdit.notes = self.notesField.text; 159 | self.itemToEdit.shouldRemind = YES; 160 | self.itemToEdit.dueDate = dueDate; 161 | 162 | // Shows the notification on the given date 163 | // [self.itemToEdit scheduleNotification]; 164 | 165 | [self.delegate addItemViewController:self didFinishEditingItem:self.itemToEdit]; 166 | } 167 | } 168 | 169 | 170 | } 171 | 172 | 173 | 174 | 175 | ///optionally we can dismiss keyboard if the user starts to scroll the tableview 176 | 177 | - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView 178 | { 179 | [self.notesField resignFirstResponder]; 180 | 181 | } 182 | 183 | 184 | 185 | - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { 186 | 187 | if (indexPath.section == 0) { 188 | cell.backgroundColor = TableCellBackgroundColor; 189 | 190 | 191 | }else{ 192 | 193 | } 194 | 195 | } 196 | 197 | 198 | ///to prevent the uitableview cell turns blue when user taps on it 199 | 200 | - (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath 201 | { 202 | if (indexPath.row == 0) { 203 | 204 | return indexPath; 205 | } else { 206 | return nil; 207 | } 208 | } 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | - (void)didReceiveMemoryWarning 217 | { 218 | [super didReceiveMemoryWarning]; 219 | 220 | // Dispose of any resources that can be recreated. 221 | } 222 | 223 | ///release te memory by setting nil to these fields as we no loner need them 224 | 225 | - (void)viewDidUnload 226 | { 227 | [self setNotesField:nil]; 228 | [self setDueDateLabel:nil]; 229 | [super viewDidUnload]; 230 | } 231 | 232 | 233 | ///we present stored item if the user editing an item 234 | 235 | - (void)setItemToEdit:(ChecklistItem *)newItem 236 | { 237 | if (itemToEdit != newItem) { 238 | itemToEdit = newItem; 239 | notes = itemToEdit.notes; 240 | shouldRemind = itemToEdit.shouldRemind; 241 | dueDate = itemToEdit.dueDate; 242 | } 243 | } 244 | 245 | 246 | 247 | #pragma mark - Table view data source 248 | 249 | 250 | 251 | ///we use prepare for segue method to display date picker controller 252 | 253 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 254 | { 255 | 256 | } 257 | 258 | 259 | 260 | 261 | -(IBAction) shareButtonClicked:(id)sender 262 | { 263 | 264 | NSString *emailBody = notesField.text; 265 | 266 | self.activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[emailBody] applicationActivities:nil]; 267 | 268 | [self presentViewController:self.activityViewController animated:YES completion:nil]; 269 | 270 | 271 | } 272 | 273 | 274 | 275 | 276 | #pragma mark - AlertView data source 277 | 278 | - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { 279 | 280 | if (alertView.tag == emptyNoteAlertViewsTag) 281 | { 282 | if (buttonIndex == alertView.cancelButtonIndex) { 283 | // Cancel was tapped 284 | NSLog(@"Cancel was tapped"); 285 | 286 | [self dismissViewControllerAnimated:YES completion:nil]; 287 | 288 | } 289 | else if (buttonIndex == alertView.firstOtherButtonIndex) 290 | { 291 | // The other button was tapped 292 | NSLog(@"OK button was tapped"); 293 | } 294 | } 295 | } 296 | 297 | 298 | #pragma mark - TextView data source 299 | 300 | - (void)textViewDidBeginEditing:(UITextView *)textView 301 | { 302 | NSLog(@"textViewDidBeginEditing..."); 303 | // self.notesField.frame.origin.y = self.navigationController.navigationBar.frame.origin.y + self.dueDateLabel.frame.origin.y; 304 | 305 | // [self.notesField setFrame:CGRectMake(0, (self.navigationController.navigationBar.frame.origin.y + self.dueDateLabel.frame.origin.y), 320.0, 500)]; 306 | } 307 | 308 | - (BOOL)textViewShouldBeginEditing:(UITextView *)textView 309 | { 310 | return YES; 311 | } 312 | 313 | 314 | 315 | 316 | -(void)customizeAppearance 317 | { 318 | self.navigationController.navigationBar.barTintColor = NavBarBackgroundColor; 319 | self.navigationController.navigationBar.translucent = NO; 320 | 321 | [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName :TableSectionHeaderTextColorYellow}]; 322 | 323 | 324 | 325 | // Create the colors 326 | UIColor *lightOp = backgroundColorGradientTop; 327 | UIColor *darkOp = backgroundColorGradientBottom; 328 | 329 | 330 | // Create the gradient 331 | CAGradientLayer *gradient = [CAGradientLayer layer]; 332 | 333 | // Set colors 334 | gradient.colors = [NSArray arrayWithObjects: 335 | (id)lightOp.CGColor, 336 | (id)darkOp.CGColor, 337 | nil]; 338 | 339 | // Set bounds 340 | gradient.frame = self.view.bounds; 341 | 342 | 343 | UIImage *gradientImage = [self imageFromLayer:gradient]; 344 | UIImage *worldBGImage = [UIImage imageNamed:@"blue-background.png"]; 345 | 346 | 347 | CGSize size = CGSizeMake(gradientImage.size.width, gradientImage.size.height); 348 | UIGraphicsBeginImageContext(size); 349 | 350 | [worldBGImage drawInRect:CGRectMake(0,0,size.width, size.height)]; 351 | [gradientImage drawInRect:CGRectMake(0,0,size.width, size.height)]; 352 | // [worldBGImage drawInRect:CGRectMake(0,0,size.width, size.height)]; 353 | 354 | UIImage *finalImage = UIGraphicsGetImageFromCurrentImageContext(); 355 | 356 | UIGraphicsEndImageContext(); 357 | 358 | 359 | self.tableView.backgroundView = [[UIImageView alloc] initWithImage:finalImage]; 360 | 361 | // [notesField setBackgroundColor:[UIColor clearColor]]; 362 | [notesField setBackgroundColor:TableCellBackgroundColor]; 363 | } 364 | 365 | - (UIImage *)imageFromLayer:(CALayer *)layer 366 | { 367 | UIGraphicsBeginImageContext([layer frame].size); 368 | 369 | [layer renderInContext:UIGraphicsGetCurrentContext()]; 370 | UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext(); 371 | 372 | UIGraphicsEndImageContext(); 373 | 374 | return outputImage; 375 | } 376 | 377 | 378 | 379 | 380 | @end 381 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHStack.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHStack.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | Copyright (c) 2002, Phillip Morelock 6 | 7 | This source code is released under the ISC License. 8 | 9 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 10 | 11 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 12 | */ 13 | 14 | #import "Util.h" 15 | 16 | /** 17 | @file CHStack.h 18 | 19 | A stack protocol with methods for LIFO ("Last In, First Out") operations. 20 | */ 21 | 22 | /** 23 | A stack protocol with methods for LIFO ("Last In, First Out") operations. 24 | 25 | A stack is commonly compared to a stack of plates. Objects may be added in any order (\link #pushObject: -pushObject:\endlink) and the most recently added object may be removed (\link #popObject -popObject\endlink) or returned without removing it (\link #topObject -topObject\endlink). 26 | 27 | @see CHDeque 28 | @see CHQueue 29 | */ 30 | @protocol CHStack 31 | 32 | /** 33 | Initialize a stack with no objects. 34 | 35 | @return An initialized stack that contains no objects. 36 | 37 | @see initWithArray: 38 | */ 39 | - (id) init; 40 | 41 | /** 42 | Initialize a stack with the contents of an array. Objects are pushed on the stack in the order they occur in the array. 43 | 44 | @param anArray An array containing objects with which to populate a new stack. 45 | @return An initialized stack that contains the objects in @a anArray. 46 | */ 47 | - (id) initWithArray:(NSArray*)anArray; 48 | 49 | #pragma mark Querying Contents 50 | /** @name Querying Contents */ 51 | // @{ 52 | 53 | /** 54 | Returns an array of the objects in this stack, ordered from top to bottom. 55 | 56 | @return An array of the objects in this stack. If the stack is empty, the array is also empty. 57 | 58 | @see count 59 | @see objectEnumerator 60 | @see removeAllObjects 61 | */ 62 | - (NSArray*) allObjects; 63 | 64 | /** 65 | Determine whether the receiver contains a given object, matched using \link NSObject-p#isEqual: -isEqual:\endlink. 66 | 67 | @param anObject The object to test for membership in the receiver. 68 | @return @c YES if the receiver contains @a anObject (as determined by \link NSObject-p#isEqual: -isEqual:\endlink), @c NO if @a anObject is @c nil or not present. 69 | 70 | @see containsObjectIdenticalTo: 71 | @see removeObject: 72 | */ 73 | - (BOOL) containsObject:(id)anObject; 74 | 75 | /** 76 | Determine whether the receiver contains a given object, matched using the == operator. 77 | 78 | @param anObject The object to test for membership in the receiver. 79 | @return @c YES if the receiver contains @a anObject (as determined by the == operator), @c NO if @a anObject is @c nil or not present. 80 | 81 | @see containsObject: 82 | @see removeObjectIdenticalTo: 83 | */ 84 | - (BOOL) containsObjectIdenticalTo:(id)anObject; 85 | 86 | /** 87 | Returns the number of objects currently on the stack. 88 | 89 | @return The number of objects currently on the stack. 90 | 91 | @see allObjects 92 | */ 93 | - (NSUInteger) count; 94 | 95 | /** 96 | Returns the lowest index of a given object, matched using @c isEqual:. 97 | 98 | @param anObject The object to search for in the receiver. 99 | @return The index of the first object which is equal to @a anObject. If none of the objects in the receiver match @a anObject, returns @c NSNotFound. 100 | 101 | @see indexOfObjectIdenticalTo: 102 | @see objectAtIndex: 103 | @see removeObjectAtIndex: 104 | */ 105 | - (NSUInteger) indexOfObject:(id)anObject; 106 | 107 | /** 108 | Returns the lowest index of a given object, matched using the == operator. 109 | 110 | @param anObject The object to be matched and located in the receiver. 111 | @return The index of the first object which is equal to @a anObject. If none of the objects in the receiver match @a anObject, returns @c NSNotFound. 112 | 113 | @see indexOfObject: 114 | @see objectAtIndex: 115 | @see removeObjectAtIndex: 116 | */ 117 | - (NSUInteger) indexOfObjectIdenticalTo:(id)anObject; 118 | 119 | /** 120 | Compares the receiving stack to another stack. Two stacks have equal contents if they each hold the same number of objects and objects at a given position in each stack satisfy the \link NSObject-p#isEqual: -isEqual:\endlink test. 121 | 122 | @param otherStack A stack. 123 | @return @c YES if the contents of @a otherStack are equal to the contents of the receiver, otherwise @c NO. 124 | */ 125 | - (BOOL) isEqualToStack:(id)otherStack; 126 | 127 | /** 128 | Returns the object located at @a index in the receiver. 129 | 130 | @param index An index from which to retrieve an object. 131 | @return The object located at @a index. 132 | 133 | @throw NSRangeException if @a index exceeds the bounds of the receiver. 134 | 135 | @see indexOfObject: 136 | @see indexOfObjectIdenticalTo: 137 | @see removeObjectAtIndex: 138 | */ 139 | - (id) objectAtIndex:(NSUInteger)index; 140 | 141 | /** 142 | Returns an enumerator that accesses each object in the stack from top to bottom. 143 | 144 | @return An enumerator that accesses each object in the stack from top to bottom. The enumerator returned is never @c nil; if the stack is empty, the enumerator will always return @c nil for \link NSEnumerator#nextObject -nextObject\endlink and an empty array for \link NSEnumerator#allObjects -allObjects\endlink. 145 | 146 | @attention The enumerator retains the collection. Once all objects in the enumerator have been consumed, the collection is released. 147 | @warning Modifying a collection while it is being enumerated is unsafe, and may cause a mutation exception to be raised. 148 | 149 | @see allObjects 150 | */ 151 | - (NSEnumerator*) objectEnumerator; 152 | 153 | /** 154 | Returns an array containing the objects in the receiver at the indexes specified by a given index set. 155 | 156 | @param indexes A set of positions corresponding to objects to retrieve from the receiver. 157 | @return A new array containing the objects in the receiver specified by @a indexes. 158 | 159 | @throw NSRangeException if any location in @a indexes exceeds the bounds of the receiver. 160 | @throw NSInvalidArgumentException if @a indexes is @c nil. 161 | 162 | @attention To retrieve objects in a given NSRange, pass [NSIndexSet indexSetWithIndexesInRange:range] as the parameter to this method. 163 | 164 | @see allObjects 165 | @see objectAtIndex: 166 | @see removeObjectsAtIndexes: 167 | */ 168 | - (NSArray*) objectsAtIndexes:(NSIndexSet*)indexes; 169 | 170 | /** 171 | Returns the object on the top of the stack without removing it. 172 | 173 | @return The topmost object from the stack. 174 | 175 | @see popObject 176 | @see pushObject: 177 | */ 178 | - (id) topObject; 179 | 180 | // @} 181 | #pragma mark Modifying Contents 182 | /** @name Modifying Contents */ 183 | // @{ 184 | 185 | /** 186 | Exchange the objects in the receiver at given indexes. 187 | 188 | @param idx1 The index of the object to replace with the object at @a idx2. 189 | @param idx2 The index of the object to replace with the object at @a idx1. 190 | 191 | @throw NSRangeException if @a idx1 or @a idx2 exceeds the bounds of the receiver. 192 | 193 | @see indexOfObject: 194 | @see objectAtIndex: 195 | */ 196 | - (void) exchangeObjectAtIndex:(NSUInteger)idx1 withObjectAtIndex:(NSUInteger)idx2; 197 | 198 | /** 199 | Remove the topmost object on the stack; no effect if the stack is already empty. 200 | 201 | @see pushObject: 202 | @see removeObject: 203 | @see topObject 204 | */ 205 | - (void) popObject; 206 | 207 | /** 208 | Add an object to the top of the stack. 209 | 210 | @param anObject The object to add to the top of the stack. 211 | 212 | @throw NSInvalidArgumentException if @a anObject is @c nil. 213 | 214 | @see popObject 215 | @see topObject 216 | */ 217 | - (void) pushObject:(id)anObject; 218 | 219 | /** 220 | Empty the receiver of all of its members. 221 | 222 | @see allObjects 223 | @see popObject 224 | @see removeObject: 225 | @see removeObjectIdenticalTo: 226 | */ 227 | - (void) removeAllObjects; 228 | 229 | /** 230 | Remove @b all occurrences of @a anObject, matched using @c isEqual:. 231 | 232 | @param anObject The object to be removed from the stack. 233 | 234 | If the stack is empty, @a anObject is @c nil, or no object matching @a anObject is found, there is no effect, aside from the possible overhead of searching the contents. 235 | 236 | @see containsObject: 237 | @see removeObjectIdenticalTo: 238 | */ 239 | - (void) removeObject:(id)anObject; 240 | 241 | /** 242 | Remove the object at a given index from the receiver. 243 | 244 | @param index The index of the object to remove. 245 | 246 | @throw NSRangeException if @a index exceeds the bounds of the receiver. 247 | 248 | @see indexOfObject: 249 | @see indexOfObjectIdenticalTo: 250 | @see objectAtIndex: 251 | */ 252 | - (void) removeObjectAtIndex:(NSUInteger)index; 253 | 254 | /** 255 | Remove @b all occurrences of @a anObject, matched using the == operator. 256 | 257 | @param anObject The object to be removed from the stack. 258 | 259 | If the stack is empty, @a anObject is @c nil, or no object matching @a anObject is found, there is no effect, aside from the possible overhead of searching the contents. 260 | 261 | @see containsObjectIdenticalTo: 262 | @see removeObject: 263 | */ 264 | - (void) removeObjectIdenticalTo:(id)anObject; 265 | 266 | /** 267 | Remove the objects at the specified indexes from the receiver. Indexes of elements beyond the first specified index will decrease. 268 | @param indexes A set of positions corresponding to objects to remove from the receiver. 269 | 270 | @throw NSRangeException if any location in @a indexes exceeds the bounds of the receiver. 271 | @throw NSInvalidArgumentException if @a indexes is @c nil. 272 | 273 | @attention To remove objects in a given @c NSRange, pass [NSIndexSet indexSetWithIndexesInRange:range] as the parameter to this method. 274 | 275 | @see objectsAtIndexes: 276 | @see removeAllObjects 277 | @see removeObjectAtIndex: 278 | */ 279 | - (void) removeObjectsAtIndexes:(NSIndexSet*)indexes; 280 | 281 | /** 282 | Replaces the object at a given index with a given object. 283 | 284 | @param index The index of the object to be replaced. 285 | @param anObject The object with which to replace the object at @a index in the receiver. 286 | 287 | @throw NSRangeException if @a index exceeds the bounds of the receiver. 288 | @throw NSInvalidArgumentException if @a anObject is @c nil. 289 | */ 290 | - (void) replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject; 291 | 292 | // @} 293 | @end 294 | -------------------------------------------------------------------------------- /Backlog Notes/Classes/thirdparty/CHDataStructures/include/CHQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | CHDataStructures.framework -- CHQueue.h 3 | 4 | Copyright (c) 2008-2010, Quinn Taylor 5 | Copyright (c) 2002, Phillip Morelock 6 | 7 | This source code is released under the ISC License. 8 | 9 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 10 | 11 | The software is provided "as is", without warranty of any kind, including all implied warranties of merchantability and fitness. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. 12 | */ 13 | 14 | #import "Util.h" 15 | 16 | /** 17 | @file CHQueue.h 18 | 19 | A queue protocol with methods for FIFO ("First In, First Out") operations. 20 | */ 21 | 22 | /** 23 | A queue protocol with methods for FIFO ("First In, First Out") operations. 24 | 25 | A queue is commonly compared to waiting in line. When objects are added, they go to the back of the line, and objects are always removed from the front of the line. These actions are accomplished using \link #addObject: -addObject:\endlink and \link #removeFirstObject -removeFirstObject\endlink, respectively. The frontmost object may be examined (not removed) using \link #firstObject -firstObject\endlink. 26 | 27 | @see CHDeque 28 | @see CHStack 29 | */ 30 | @protocol CHQueue 31 | 32 | /** 33 | Initialize a queue with no objects. 34 | 35 | @return An initialized queue that contains no objects. 36 | 37 | @see initWithArray: 38 | */ 39 | - (id) init; 40 | 41 | /** 42 | Initialize a queue with the contents of an array. Objects are enqueued in the order they occur in the array. 43 | 44 | @param anArray An array containing objects with which to populate a new queue. 45 | @return An initialized queue that contains the objects in @a anArray. 46 | */ 47 | - (id) initWithArray:(NSArray*)anArray; 48 | 49 | #pragma mark Querying Contents 50 | /** @name Querying Contents */ 51 | // @{ 52 | 53 | /** 54 | Returns an array with the objects in this queue, ordered from front to back. 55 | 56 | @return An array with the objects in this queue. If the queue is empty, the array is also empty. 57 | 58 | @see count 59 | @see objectEnumerator 60 | @see removeAllObjects 61 | */ 62 | - (NSArray*) allObjects; 63 | 64 | /** 65 | Determine whether the receiver contains a given object, matched using \link NSObject-p#isEqual: -isEqual:\endlink. 66 | 67 | @param anObject The object to test for membership in the receiver. 68 | @return @c YES if the receiver contains @a anObject (as determined by \link NSObject-p#isEqual: -isEqual:\endlink), @c NO if @a anObject is @c nil or not present. 69 | 70 | @see containsObjectIdenticalTo: 71 | @see removeObject: 72 | */ 73 | - (BOOL) containsObject:(id)anObject; 74 | 75 | /** 76 | Determine whether the receiver contains a given object, matched using the == operator. 77 | 78 | @param anObject The object to test for membership in the receiver. 79 | @return @c YES if the receiver contains @a anObject (as determined by the == operator), @c NO if @a anObject is @c nil or not present. 80 | 81 | @see containsObject: 82 | @see removeObjectIdenticalTo: 83 | */ 84 | - (BOOL) containsObjectIdenticalTo:(id)anObject; 85 | 86 | /** 87 | Returns the number of objects currently in the queue. 88 | 89 | @return The number of objects currently in the queue. 90 | 91 | @see allObjects 92 | */ 93 | - (NSUInteger) count; 94 | 95 | /** 96 | Returns the object at the front of the queue without removing it. 97 | 98 | @return The first object in the queue, or @c nil if the queue is empty. 99 | 100 | @see lastObject 101 | @see removeFirstObject 102 | */ 103 | - (id) firstObject; 104 | 105 | /** 106 | Returns the lowest index of a given object, matched using @c isEqual:. 107 | 108 | @param anObject The object to search for in the receiver. 109 | @return The index of the first object which is equal to @a anObject. If none of the objects in the receiver match @a anObject, returns @c NSNotFound. 110 | 111 | @see indexOfObjectIdenticalTo: 112 | @see objectAtIndex: 113 | @see removeObjectAtIndex: 114 | */ 115 | - (NSUInteger) indexOfObject:(id)anObject; 116 | 117 | /** 118 | Returns the lowest index of a given object, matched using the == operator. 119 | 120 | @param anObject The object to be matched and located in the receiver. 121 | @return The index of the first object which is equal to @a anObject. If none of the objects in the receiver match @a anObject, returns @c NSNotFound. 122 | 123 | @see indexOfObject: 124 | @see objectAtIndex: 125 | @see removeObjectAtIndex: 126 | */ 127 | - (NSUInteger) indexOfObjectIdenticalTo:(id)anObject; 128 | 129 | /** 130 | Compares the receiving queue to another queue. Two queues have equal contents if they each hold the same number of objects and objects at a given position in each queue satisfy the \link NSObject-p#isEqual: -isEqual:\endlink test. 131 | 132 | @param otherQueue A queue. 133 | @return @c YES if the contents of @a otherQueue are equal to the contents of the receiver, otherwise @c NO. 134 | */ 135 | - (BOOL) isEqualToQueue:(id)otherQueue; 136 | 137 | /** 138 | Returns the object at the back of the queue without removing it. 139 | 140 | @return The last object in the queue, or @c nil if the queue is empty. 141 | 142 | @see addObject: 143 | @see firstObject 144 | */ 145 | - (id) lastObject; 146 | 147 | /** 148 | Returns the object located at @a index in the receiver. 149 | 150 | @param index An index from which to retrieve an object. 151 | @return The object located at @a index. 152 | 153 | @throw NSRangeException if @a index exceeds the bounds of the receiver. 154 | 155 | @see indexOfObject: 156 | @see indexOfObjectIdenticalTo: 157 | @see removeObjectAtIndex: 158 | */ 159 | - (id) objectAtIndex:(NSUInteger)index; 160 | 161 | /** 162 | Returns an enumerator that accesses each object in the queue from front to back. 163 | 164 | @return An enumerator that accesses each object in the queue from front to back. The enumerator returned is never @c nil; if the queue is empty, the enumerator will always return @c nil for \link NSEnumerator#nextObject -nextObject\endlink and an empty array for \link NSEnumerator#allObjects -allObjects\endlink. 165 | 166 | @attention The enumerator retains the collection. Once all objects in the enumerator have been consumed, the collection is released. 167 | @warning Modifying a collection while it is being enumerated is unsafe, and may cause a mutation exception to be raised. 168 | 169 | @see allObjects 170 | */ 171 | - (NSEnumerator*) objectEnumerator; 172 | 173 | /** 174 | Returns an array containing the objects in the receiver at the indexes specified by a given index set. 175 | 176 | @param indexes A set of positions corresponding to objects to retrieve from the receiver. 177 | @return A new array containing the objects in the receiver specified by @a indexes. 178 | 179 | @throw NSRangeException if any location in @a indexes exceeds the bounds of the receiver. 180 | @throw NSInvalidArgumentException if @a indexes is @c nil. 181 | 182 | @attention To retrieve objects in a given NSRange, pass [NSIndexSet indexSetWithIndexesInRange:range] as the parameter to this method. 183 | 184 | @see allObjects 185 | @see objectAtIndex: 186 | @see removeObjectsAtIndexes: 187 | */ 188 | - (NSArray*) objectsAtIndexes:(NSIndexSet*)indexes; 189 | 190 | // @} 191 | #pragma mark Modifying Contents 192 | /** @name Modifying Contents */ 193 | // @{ 194 | 195 | /** 196 | Add an object to the back of the queue. 197 | 198 | @param anObject The object to add to the back of the queue. 199 | 200 | @throw NSInvalidArgumentException if @a anObject is @c nil. 201 | 202 | @see lastObject 203 | @see removeFirstObject 204 | */ 205 | - (void) addObject:(id)anObject; 206 | 207 | /** 208 | Exchange the objects in the receiver at given indexes. 209 | 210 | @param idx1 The index of the object to replace with the object at @a idx2. 211 | @param idx2 The index of the object to replace with the object at @a idx1. 212 | 213 | @throw NSRangeException if @a idx1 or @a idx2 exceeds the bounds of the receiver. 214 | 215 | @see indexOfObject: 216 | @see objectAtIndex: 217 | */ 218 | - (void) exchangeObjectAtIndex:(NSUInteger)idx1 withObjectAtIndex:(NSUInteger)idx2; 219 | 220 | /** 221 | Empty the receiver of all of its members. 222 | 223 | @see allObjects 224 | @see removeFirstObject 225 | @see removeObject: 226 | @see removeObjectIdenticalTo: 227 | */ 228 | - (void) removeAllObjects; 229 | 230 | /** 231 | Remove the front object in the queue; no effect if the queue is already empty. 232 | 233 | @see firstObject 234 | @see removeObject: 235 | */ 236 | - (void) removeFirstObject; 237 | 238 | /** 239 | Remove @b all occurrences of @a anObject, matched using @c isEqual:. 240 | 241 | @param anObject The object to be removed from the queue. 242 | 243 | If the queue is empty, @a anObject is @c nil, or no object matching @a anObject is found, there is no effect, aside from the possible overhead of searching the contents. 244 | 245 | @see containsObject: 246 | @see removeObjectIdenticalTo: 247 | */ 248 | - (void) removeObject:(id)anObject; 249 | 250 | /** 251 | Remove the object at a given index from the receiver. 252 | 253 | @param index The index of the object to remove. 254 | 255 | @throw NSRangeException if @a index exceeds the bounds of the receiver. 256 | 257 | @see indexOfObject: 258 | @see indexOfObjectIdenticalTo: 259 | @see objectAtIndex: 260 | */ 261 | - (void) removeObjectAtIndex:(NSUInteger)index; 262 | 263 | /** 264 | Remove @b all occurrences of @a anObject, matched using the == operator. 265 | 266 | @param anObject The object to be removed from the queue. 267 | 268 | If the queue is empty, @a anObject is @c nil, or no object matching @a anObject is found, there is no effect, aside from the possible overhead of searching the contents. 269 | 270 | @see containsObjectIdenticalTo: 271 | @see removeObject: 272 | */ 273 | - (void) removeObjectIdenticalTo:(id)anObject; 274 | 275 | /** 276 | Remove the objects at the specified indexes from the receiver. Indexes of elements beyond the first specified index will decrease. 277 | @param indexes A set of positions corresponding to objects to remove from the receiver. 278 | 279 | @throw NSRangeException if any location in @a indexes exceeds the bounds of the receiver. 280 | @throw NSInvalidArgumentException if @a indexes is @c nil. 281 | 282 | @attention To remove objects in a given @c NSRange, pass [NSIndexSet indexSetWithIndexesInRange:range] as the parameter to this method. 283 | 284 | @see objectsAtIndexes: 285 | @see removeAllObjects 286 | @see removeObjectAtIndex: 287 | */ 288 | - (void) removeObjectsAtIndexes:(NSIndexSet*)indexes; 289 | 290 | /** 291 | Replaces the object at a given index with a given object. 292 | 293 | @param index The index of the object to be replaced. 294 | @param anObject The object with which to replace the object at @a index in the receiver. 295 | 296 | @throw NSRangeException if @a index exceeds the bounds of the receiver. 297 | @throw NSInvalidArgumentException if @a anObject is @c nil. 298 | */ 299 | - (void) replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject; 300 | 301 | // @} 302 | @end 303 | --------------------------------------------------------------------------------