vendor/Pods/NanoStore/Classes/Public/NSFNanoExpression.m in nano-store-0.6.1 vs vendor/Pods/NanoStore/Classes/Public/NSFNanoExpression.m in nano-store-0.6.2
- old
+ new
@@ -29,15 +29,17 @@
#import "NSFOrderedDictionary.h"
@implementation NSFNanoExpression
{
/** \cond */
- NSMutableArray *_predicates;
- NSMutableArray *_operators;
+ NSMutableArray *predicates;
+ NSMutableArray *operators;
/** \endcond */
}
+@synthesize predicates, operators;
+
+ (NSFNanoExpression*)expressionWithPredicate:(NSFNanoPredicate *)aPredicate
{
return [[self alloc]initWithPredicate:aPredicate];
}
@@ -48,14 +50,14 @@
reason:[NSString stringWithFormat:@"*** -[%@ %@]: the predicate is nil.", [self class], NSStringFromSelector(_cmd)]
userInfo:nil]raise];
}
if ((self = [super init])) {
- _predicates = [NSMutableArray new];
- [_predicates addObject:aPredicate];
- _operators = [NSMutableArray new];
- [_operators addObject:[NSNumber numberWithInt:NSFAnd]];
+ predicates = [NSMutableArray new];
+ [predicates addObject:aPredicate];
+ operators = [NSMutableArray new];
+ [operators addObject:[NSNumber numberWithInt:NSFAnd]];
}
return self;
}
@@ -71,12 +73,12 @@
if (nil == aPredicate)
[[NSException exceptionWithName:NSFUnexpectedParameterException
reason:[NSString stringWithFormat:@"*** -[%@ %@]: the predicate is nil.", [self class], NSStringFromSelector(_cmd)]
userInfo:nil]raise];
- [_predicates addObject:aPredicate];
- [_operators addObject:[NSNumber numberWithInt:someOperator]];
+ [predicates addObject:aPredicate];
+ [operators addObject:[NSNumber numberWithInt:someOperator]];
}
- (NSString *)description
{
NSArray *values = [self arrayDescription];
@@ -84,17 +86,17 @@
return [values componentsJoinedByString:@""];
}
- (NSArray *)arrayDescription
{
- NSUInteger i, count = [_predicates count];
+ NSUInteger i, count = [predicates count];
NSMutableArray *values = [NSMutableArray new];
// We always have one predicate, so make sure add it
- [values addObject:[[_predicates objectAtIndex:0]description]];
+ [values addObject:[[predicates objectAtIndex:0]description]];
for (i = 1; i < count; i++) {
- NSString *compound = [[NSString alloc]initWithFormat:@" %@ %@", ([[_operators objectAtIndex:i]intValue] == NSFAnd) ? @"AND" : @"OR", [[_predicates objectAtIndex:i]description]];
+ NSString *compound = [[NSString alloc]initWithFormat:@" %@ %@", ([[operators objectAtIndex:i]intValue] == NSFAnd) ? @"AND" : @"OR", [[predicates objectAtIndex:i]description]];
[values addObject:compound];
}
return values;
}
\ No newline at end of file