Archived
1

Added MPRange and Tests

This commit is contained in:
Kim Wittenburg
2014-04-21 18:17:56 +02:00
parent 6f32672b40
commit f1953baafa
3 changed files with 274 additions and 0 deletions

39
MathPad/MPRange.h Normal file
View File

@@ -0,0 +1,39 @@
//
// MPRange.h
// MathPad
//
// Created by Kim Wittenburg on 18.04.14.
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
@interface MPRange : NSObject <NSCopying, NSCoding>
#pragma mark Creation Methods
- (instancetype)init;
- (instancetype)initWithLocation:(NSIndexPath *)location
length:(NSUInteger)length;
- (instancetype)initWithRange:(NSRange)aRange;
+ (instancetype)emptyRange;
+ (instancetype)rangeWithLocation:(NSIndexPath *)location
length:(NSUInteger)length;
+ (instancetype)rangeWithRange:(NSRange)aRange;
#pragma mark Properties
@property (nonatomic, strong) NSIndexPath *location;
@property (nonatomic) NSUInteger length;
- (NSIndexPath *)maxRange;
- (NSRange)rangeAtLastIndex;
#pragma mark Working with Ranges
- (BOOL)containsRange:(MPRange *)aRange;
- (BOOL)containsLocation:(NSIndexPath *)location;
- (BOOL)isEqual:(id)object;
- (BOOL)isEqualToRange:(MPRange *)aRange;
@end