Model Redesign: Added Reference Frames
Added Inverse Functions UI Redesign Cleaned Code
This commit is contained in:
@@ -12,6 +12,7 @@ NSString *MPMathRulesAllowsImplicitMultiplicationKey = @"MPMathRulesAllowsImplic
|
||||
NSString *MPMathRulesMaximumOperatorChainLengthKey = @"MPMathRulesMaximumOperatorChainLengthKey";
|
||||
NSString *MPMathRulesMaximumOperatorChainLengthInMultiplicationKey = @"MPMathRulesMaximumOperatorChainLengthInMultiplicationKey";
|
||||
NSString *MPMathRulesMaximumOperatorChainLengthInFunctionKey = @"MPMathRulesMaximumOperatorChainLengthInFunctionKey";
|
||||
NSString *MPMathRulesIsUsingDegreesKey = @"MPMathRulesIsUsingDegreesKey";
|
||||
|
||||
@implementation MPMathRules
|
||||
|
||||
@@ -33,15 +34,18 @@ static MPMathRules *sharedRules;
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_usingUserDefaultValues = YES;
|
||||
NSNumber *userDefaultsAllowImplicitMultiplication = [[NSUserDefaults standardUserDefaults] objectForKey:MPMathRulesAllowsImplicitMultiplicationKey];
|
||||
NSNumber *userDefaultsMaximumOperatorChainLength = [[NSUserDefaults standardUserDefaults] objectForKey:MPMathRulesMaximumOperatorChainLengthKey];
|
||||
NSNumber *userDefaultsMaximumOperatorChainLengthInMultiplication = [[NSUserDefaults standardUserDefaults] objectForKey:MPMathRulesMaximumOperatorChainLengthInMultiplicationKey];
|
||||
NSNumber *userDefaultsMaximumOperatorChainLengthInFunction = [[NSUserDefaults standardUserDefaults] objectForKey:MPMathRulesMaximumOperatorChainLengthInFunctionKey];
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
NSNumber *userDefaultsAllowImplicitMultiplication = [userDefaults objectForKey:MPMathRulesAllowsImplicitMultiplicationKey];
|
||||
NSNumber *userDefaultsMaximumOperatorChainLength = [userDefaults objectForKey:MPMathRulesMaximumOperatorChainLengthKey];
|
||||
NSNumber *userDefaultsMaximumOperatorChainLengthInMultiplication = [userDefaults objectForKey:MPMathRulesMaximumOperatorChainLengthInMultiplicationKey];
|
||||
NSNumber *userDefaultsMaximumOperatorChainLengthInFunction = [userDefaults objectForKey:MPMathRulesMaximumOperatorChainLengthInFunctionKey];
|
||||
NSNumber *userDefaultsIsUsingDegrees = [userDefaults objectForKey:MPMathRulesIsUsingDegreesKey];
|
||||
|
||||
_allowsImplicitMultiplication = userDefaultsAllowImplicitMultiplication != nil ? userDefaultsAllowImplicitMultiplication.boolValue : NO;
|
||||
_allowsImplicitMultiplication = userDefaultsAllowImplicitMultiplication.boolValue;
|
||||
_maximumOperatorChainLength = userDefaultsMaximumOperatorChainLength != nil ? userDefaultsMaximumOperatorChainLength.unsignedIntegerValue : 2;
|
||||
_maximumOperatorChainLengthInMultiplication = userDefaultsMaximumOperatorChainLengthInMultiplication != nil ? userDefaultsMaximumOperatorChainLengthInMultiplication.unsignedIntegerValue : 1;
|
||||
_maximumOperatorChainLengthInFunction = userDefaultsMaximumOperatorChainLengthInFunction != nil ? userDefaultsMaximumOperatorChainLengthInFunction.unsignedIntegerValue : 1;
|
||||
_isUsingDegrees = userDefaultsIsUsingDegrees.boolValue;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -54,6 +58,7 @@ static MPMathRules *sharedRules;
|
||||
self.maximumOperatorChainLength = self.maximumOperatorChainLength;
|
||||
self.maximumOperatorChainLengthInMultiplication = self.maximumOperatorChainLengthInMultiplication;
|
||||
self.maximumOperatorChainLengthInFunction = self.maximumOperatorChainLengthInFunction;
|
||||
self.isUsingDegrees = self.isUsingDegrees;
|
||||
}
|
||||
|
||||
- (void)setAllowsImplicitMultiplication:(BOOL)allowsImplicitMultiplication
|
||||
@@ -69,7 +74,7 @@ static MPMathRules *sharedRules;
|
||||
{
|
||||
_maximumOperatorChainLength = maximumOperatorChainLength;
|
||||
if (self.isUsingUserDefaultValues) {
|
||||
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithUnsignedInteger:maximumOperatorChainLength]
|
||||
[[NSUserDefaults standardUserDefaults] setObject:@(maximumOperatorChainLength)
|
||||
forKey:MPMathRulesMaximumOperatorChainLengthKey];
|
||||
}
|
||||
}
|
||||
@@ -78,7 +83,7 @@ static MPMathRules *sharedRules;
|
||||
{
|
||||
_maximumOperatorChainLengthInMultiplication = maximumOperatorChainLengthInMultiplication;
|
||||
if (self.isUsingUserDefaultValues) {
|
||||
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithUnsignedInteger:maximumOperatorChainLengthInMultiplication]
|
||||
[[NSUserDefaults standardUserDefaults] setObject:@(maximumOperatorChainLengthInMultiplication)
|
||||
forKey:MPMathRulesMaximumOperatorChainLengthInMultiplicationKey];
|
||||
}
|
||||
}
|
||||
@@ -87,9 +92,18 @@ static MPMathRules *sharedRules;
|
||||
{
|
||||
_maximumOperatorChainLengthInFunction = maximumOperatorChainLengthInFunction;
|
||||
if (self.isUsingUserDefaultValues) {
|
||||
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithUnsignedInteger:maximumOperatorChainLengthInFunction]
|
||||
[[NSUserDefaults standardUserDefaults] setObject:@(maximumOperatorChainLengthInFunction)
|
||||
forKey:MPMathRulesMaximumOperatorChainLengthInFunctionKey];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setIsUsingDegrees:(BOOL)isUsingDegrees
|
||||
{
|
||||
_isUsingDegrees = isUsingDegrees;
|
||||
if (self.isUsingUserDefaultValues) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:isUsingDegrees
|
||||
forKey:MPMathRulesIsUsingDegreesKey];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user