Added MPRange and Tests
This commit is contained in:
39
MathPad/MPRange.h
Normal file
39
MathPad/MPRange.h
Normal 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
|
||||
Reference in New Issue
Block a user