Archived
1

Renamed MPRange to MPRangePath

Added MPRangeExtension Category on MPExpression
This commit is contained in:
Kim Wittenburg
2014-04-23 03:11:07 +02:00
parent 3c944f3fc0
commit 2163f24509
2 changed files with 200 additions and 0 deletions

47
MathPad/MPRangePath.h Normal file
View File

@@ -0,0 +1,47 @@
//
// MPRange.h
// MathPad
//
// Created by Kim Wittenburg on 18.04.14.
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import "MPExpression.h"
@interface MPRangePath : NSObject <NSCopying, NSCoding>
#pragma mark Creation Methods
- (instancetype)init;
- (instancetype)initWithLocation:(NSIndexPath *)location
length:(NSUInteger)length;
- (instancetype)initWithRange:(NSRange)aRange;
+ (instancetype)emptyRangePath;
+ (instancetype)rangePathWithLocation:(NSIndexPath *)location
length:(NSUInteger)length;
+ (instancetype)rangePathWithRange:(NSRange)aRange;
#pragma mark Properties
@property (nonatomic, strong) NSIndexPath *location;
@property (nonatomic) NSUInteger length;
- (NSIndexPath *)maxRangePath;
- (NSRange)rangeAtLastIndex;
#pragma mark Working with Ranges
- (BOOL)containsRangePath:(MPRangePath *)aRangePath;
- (BOOL)containsLocation:(NSIndexPath *)location;
- (BOOL)isEqual:(id)object;
- (BOOL)isEqualToRangePath:(MPRangePath *)aRangePath;
@end
@interface MPExpression (MPRangeExtension)
- (MPExpression *)subexpressionWithRangePath:(MPRangePath *)aRangePath; // If location points to expression (in function) nil is returned
@end