Add Documentation and Clean Code
This commit is contained in:
4
MathKit/MPExpressionView.m
Normal file → Executable file
4
MathKit/MPExpressionView.m
Normal file → Executable file
@@ -713,7 +713,9 @@
|
||||
if (self.functionsPopover.isShown) {
|
||||
[self.functionsPopover close];
|
||||
} else {
|
||||
[self.functionsPopover showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMaxYEdge];
|
||||
[self.functionsPopover showRelativeToRect:[sender bounds]
|
||||
ofView:self.functionsButton
|
||||
preferredEdge:NSMaxYEdge];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
4
MathKit/MPFractionFunctionLayout.m
Normal file → Executable file
4
MathKit/MPFractionFunctionLayout.m
Normal file → Executable file
@@ -11,8 +11,8 @@
|
||||
#import "MPFractionFunction.h"
|
||||
|
||||
|
||||
#define kFractionFunctionLineWidth 1.0
|
||||
#define kFractionFunctionHorizontalInset 2.0
|
||||
#define kFractionFunctionLineWidth 1
|
||||
#define kFractionFunctionHorizontalInset 2
|
||||
#define kFractionFunctionNominatorOffset 0
|
||||
#define kFractionFunctionDenominatorOffset 0
|
||||
|
||||
|
||||
2
MathKit/MPFractionTerm.h
Normal file → Executable file
2
MathKit/MPFractionTerm.h
Normal file → Executable file
@@ -24,7 +24,7 @@
|
||||
@abstract Represens a <code>@link
|
||||
//apple_ref/occ/cl/MPFractionFunction@/link</code>.
|
||||
|
||||
@discussion A fraction is evaluating by dividing the numerator by the
|
||||
@discussion A fraction is evaluated by dividing the numerator by the
|
||||
denominator.
|
||||
*/
|
||||
@interface MPFractionTerm : MPFunctionTerm
|
||||
|
||||
8
MathKit/MPSumFunction.h
Normal file → Executable file
8
MathKit/MPSumFunction.h
Normal file → Executable file
@@ -29,9 +29,9 @@
|
||||
the start expression and the target expressions are included in
|
||||
the iterations.
|
||||
|
||||
Each iteration the sum value is incremented by <code>1</code>. If
|
||||
the start and target expression evaluate to the same value the
|
||||
sum is evaluated once.
|
||||
Each iteration the iteration value is incremented by
|
||||
<code>1</code>. If the start and target expression evaluate to
|
||||
the same value the sum is evaluated once.
|
||||
*/
|
||||
@interface MPSumFunction : MPFunction
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
@discussion The start expression must define a variable that may be used in
|
||||
the sum expression. If the start expression does not define a
|
||||
variable the sum function will fail on validation.
|
||||
variable the sum function will not be evaluatable.
|
||||
*/
|
||||
@property (nonatomic, strong) MPExpression *startExpression; /* Index 0 */
|
||||
|
||||
|
||||
5
MathKit/MPSumFunctionTerm.m
Normal file → Executable file
5
MathKit/MPSumFunctionTerm.m
Normal file → Executable file
@@ -17,13 +17,12 @@
|
||||
- (NSDecimalNumber *)doEvaluation:(NSError *__autoreleasing *)error
|
||||
{
|
||||
MPParsedExpression *startExpression = [self expressionAtIndex:0];
|
||||
MPParsedExpression *sumExpression = [self expressionAtIndex:2];
|
||||
|
||||
NSDecimalNumber *start = [startExpression evaluate:error];
|
||||
ReturnNilIfNil(start);
|
||||
MPEvaluateExpression(target, 1);
|
||||
NSDecimalNumber *value = [NSDecimalNumber zero];
|
||||
|
||||
MPParsedExpression *sumExpression = [self expressionAtIndex:2];
|
||||
NSDecimalNumber *value = [NSDecimalNumber zero];
|
||||
for (NSDecimalNumber *current = start;
|
||||
[current compare:target] <= 0;
|
||||
current = [current decimalNumberByAdding:[[NSDecimalNumber alloc] initWithInteger:1]]) {
|
||||
|
||||
Reference in New Issue
Block a user