Archived
1

Corrected MPExpression -itemAtIndex:referenceFrame:MPSymbolReferenceFrame

Corrected Deformed Number Format
Added "arcsin", "arccos", "arctan", "lg", "log", "ln" Elementary Functions
This commit is contained in:
Kim Wittenburg
2014-12-11 15:32:06 +01:00
parent 98e4a6dde6
commit c367b1dbe8
7 changed files with 105 additions and 38 deletions

View File

@@ -269,18 +269,17 @@ NSString *const MPIllegalElementExceptionElementKey = @"MPIllegalElementExceptio
case MPSymbolReferenceFrame:
{
NSUInteger location = 0;
NSUInteger elementIndex = 0;
id <MPExpressionElement> element = nil;
while (location < anIndex) {
element = _elements[elementIndex++];
location += element.length;
}
if (location == anIndex && element.isFunction) {
NSUInteger offsetInElement;
NSUInteger elementIndex = [self convertIndex:anIndex
fromReferenceFrame:MPSymbolReferenceFrame
toReferenceFrame:MPElementReferenceFrame
offset:&offsetInElement];
id<MPExpressionElement> element = [self elementAtIndex:elementIndex];
if ([element isFunction]) {
return element;
} else {
return [((NSString *)element) substringWithRange:NSMakeRange(offsetInElement, 1)];
}
NSUInteger indexInString = location - element.length + anIndex;
return [((NSString *)element) substringWithRange:NSMakeRange(indexInString, 1)];
}
case MPTokenReferenceFrame: