Internal Redesign:
- Combined MPExpression and MPMutableExpression - Abstracted children of MPExpression into MPExpressionElement protocol - Abstracted most of MPExpressionLayout and MPFunctionLayout into common superclass MPLayout
This commit is contained in:
@@ -6,58 +6,47 @@
|
||||
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
|
||||
//
|
||||
|
||||
@import Foundation;
|
||||
#import "MPExpressionElement.h"
|
||||
|
||||
@class MPFunction, MPExpression, MPRangePath;
|
||||
|
||||
@interface MPFunction : NSObject <NSCopying, NSCoding>
|
||||
@interface MPFunction : NSObject <NSCoding, NSCopying, MPExpressionElement>
|
||||
|
||||
#pragma mark Creation Methods
|
||||
|
||||
- (instancetype)init;
|
||||
|
||||
#pragma mark Working With the Expression Tree
|
||||
#pragma mark Properties
|
||||
// Subclasses should define accessor properties for all sub expressions, which, in the setter, should send didChangeElementAtRangePath:replacementLength: to self with a replacement length of 1.
|
||||
|
||||
#pragma mark Working With the Expression Tree
|
||||
@property (nonatomic, weak) MPExpression *parent; // Documentation: Do not set
|
||||
|
||||
- (NSUInteger)numberOfChildren;
|
||||
- (MPExpression *)childAtIndex:(NSUInteger)index;
|
||||
- (NSUInteger)numberOfChildren; // Override
|
||||
- (MPExpression *)childAtIndex:(NSUInteger)index; // Override
|
||||
- (void)setChild:(MPExpression *)child
|
||||
atIndex:(NSUInteger)index;
|
||||
|
||||
#pragma mark Evaluating Functions
|
||||
|
||||
- (double)doubleValue;
|
||||
|
||||
#pragma mark Working With Functions
|
||||
|
||||
- (BOOL)isEqualToFunction:(MPFunction *)aFunction;
|
||||
|
||||
@end
|
||||
|
||||
@interface MPFunction (MPFunctionExtensionMethods)
|
||||
|
||||
#pragma mark Working With the Expression Tree
|
||||
atIndex:(NSUInteger)index; // Override
|
||||
|
||||
// May be overridden for performance improvements
|
||||
- (NSArray *)children;
|
||||
- (NSArray *)children; // Indexes must equal the ones from the native methods
|
||||
- (NSUInteger)indexOfChild:(MPExpression *)child;
|
||||
|
||||
- (id)symbolAtIndexPath:(NSIndexPath *)indexPath;
|
||||
- (id)elementAtIndexPath:(NSIndexPath *)indexPath;
|
||||
|
||||
#pragma mark Evaluating Functions
|
||||
- (double)doubleValue; // Override
|
||||
|
||||
- (float)floatValue;
|
||||
- (int)intValue;
|
||||
- (NSInteger)integerValue;
|
||||
- (long long)longLongValue;
|
||||
#pragma mark Messages
|
||||
- (void)didChangeElementsInRangePath:(MPRangePath *)rangePath
|
||||
replacementLength:(NSUInteger)replacementLength;
|
||||
- (void)didChangeChild:(MPExpression *)child;
|
||||
- (void)didChangeChildAtIndex:(NSUInteger)index;
|
||||
|
||||
- (NSString *)description;
|
||||
#pragma mark Working With Functions
|
||||
- (BOOL)isEqualToFunction:(MPFunction *)aFunction; // Override
|
||||
|
||||
- (NSUInteger)hash;
|
||||
|
||||
@end
|
||||
|
||||
@interface MPFunction (MPDisplayExtension)
|
||||
|
||||
- (void)symbolsChangedInRangePath:(MPRangePath *)rangePath replacementLength:(NSUInteger)length;
|
||||
- (NSString *)description; // Should be overridden
|
||||
- (NSUInteger)hash;// Override
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user