-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jasper Blues
committed
Jan 26, 2014
1 parent
a1007d2
commit 10efb5f
Showing
26 changed files
with
3,164 additions
and
3,087 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
c39d78cda9a83c12ebe529161fa6d974c9b0f0a3 | ||
ff202de3006b041683d6dceebbb7c2e328069855 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// TYPHOON FRAMEWORK | ||
// Copyright 2013, Jasper Blues & Contributors | ||
// All Rights Reserved. | ||
// | ||
// NOTICE: The authors permit you to use, modify, and distribute this file | ||
// in accordance with the terms of the license agreement accompanying it. | ||
// | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@class TyphoonStackItem; | ||
|
||
@interface TyphoonComponentSolvingStack : NSObject | ||
|
||
+ (instancetype)stack; | ||
|
||
- (void)push:(TyphoonStackItem*)stackItem; | ||
|
||
- (TyphoonStackItem*)pop; | ||
|
||
- (TyphoonStackItem*)peek; | ||
|
||
- (TyphoonStackItem*)itemForKey:(NSString*)key; | ||
|
||
- (BOOL)isEmpty; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
//////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// TYPHOON FRAMEWORK | ||
// Copyright 2013, Jasper Blues & Contributors | ||
// All Rights Reserved. | ||
// | ||
// NOTICE: The authors permit you to use, modify, and distribute this file | ||
// in accordance with the terms of the license agreement accompanying it. | ||
// | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
#import "TyphoonComponentSolvingStack.h" | ||
#import "TyphoonStackItem.h" | ||
#import "TyphoonDefinition.h" | ||
#import "OCLogTemplate.h" | ||
|
||
@implementation TyphoonComponentSolvingStack | ||
{ | ||
NSMutableArray* _storage; | ||
} | ||
|
||
|
||
/* ====================================================================================================================================== */ | ||
#pragma mark - Class Methods | ||
|
||
+ (instancetype)stack | ||
{ | ||
return [[self alloc] init]; | ||
} | ||
|
||
/* ====================================================================================================================================== */ | ||
#pragma mark - Initialization & Destruction | ||
|
||
- (id)init | ||
{ | ||
self = [super init]; | ||
if (self) | ||
{ | ||
_storage = [NSMutableArray array]; | ||
} | ||
return self; | ||
} | ||
|
||
|
||
/* ====================================================================================================================================== */ | ||
#pragma mark - Interface Methods | ||
|
||
- (void)push:(TyphoonStackItem*)stackItem | ||
{ | ||
if (![stackItem isKindOfClass:[TyphoonStackItem class]]) | ||
{ | ||
[NSException raise:NSInvalidArgumentException format:@"Not a TyphoonStackItem: %@", stackItem]; | ||
} | ||
if ([self itemForKey:stackItem.definition.key]) | ||
{ | ||
LogDebug(@"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ already in!!!!!!!!!!"); | ||
return; | ||
} | ||
[_storage addObject:stackItem]; | ||
} | ||
|
||
- (TyphoonStackItem*)pop | ||
{ | ||
id element = [_storage lastObject]; | ||
if ([self isEmpty] == NO) | ||
{ | ||
[_storage removeLastObject]; | ||
} | ||
return element; | ||
} | ||
|
||
- (TyphoonStackItem*)peek | ||
{ | ||
return [_storage lastObject]; | ||
} | ||
|
||
- (TyphoonStackItem*)itemForKey:(NSString*)key | ||
{ | ||
for (TyphoonStackItem* item in _storage) | ||
{ | ||
if ([item.definition.key isEqualToString:key]) | ||
{ | ||
return item; | ||
} | ||
} | ||
return nil; | ||
} | ||
|
||
|
||
- (BOOL)isEmpty | ||
{ | ||
return ([_storage count] == 0); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// TYPHOON FRAMEWORK | ||
// Copyright 2013, Jasper Blues & Contributors | ||
// All Rights Reserved. | ||
// | ||
// NOTICE: The authors permit you to use, modify, and distribute this file | ||
// in accordance with the terms of the license agreement accompanying it. | ||
// | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@class TyphoonDefinition; | ||
|
||
|
||
@interface TyphoonStackItem : NSObject | ||
|
||
@property(nonatomic, strong, readonly) TyphoonDefinition* definition; | ||
@property(nonatomic, strong, readonly) id instance; | ||
|
||
|
||
+ (instancetype)itemWithDefinition:(TyphoonDefinition*)definition instance:(id)instance; | ||
|
||
- (BOOL)isEqual:(id)other; | ||
|
||
- (BOOL)isEqualToItem:(TyphoonStackItem*)item; | ||
|
||
- (NSUInteger)hash; | ||
|
||
|
||
|
||
@end |
Oops, something went wrong.