Corrected MPExpression -itemAtIndex:referenceFrame:MPSymbolReferenceFrame
Corrected Deformed Number Format Added "arcsin", "arccos", "arctan", "lg", "log", "ln" Elementary Functions
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user