text:
NSString * const RDMUserDidChangeNotification = @"RDMUserDidChangeNotification";

@interface RDMTeacherAccountController ()

@property (nonatomic, strong) RDMTeacherDataController *dataController;
@property (nonatomic, strong) RDMLoginAPIClient *loginAPIClient;
@property (nonatomic, strong) RDMTokenAuthAPIClient *tokenBasedAPIClient;

@property (nonatomic, strong) NSDateFormatter *dateFormatter;

@end

@implementation RDMTeacherAccountController

-(instancetype) initWithDataController:(RDMTeacherDataController*)dataController {
    self = [super init];
    if (self) {
        _dataController = dataController;
        _loginAPIClient = [RDMLoginAPIClient sharedClient];
        _tokenBasedAPIClient = [RDMTokenAuthAPIClient sharedClient];

        _dateFormatter = [[NSDateFormatter alloc] init];
        [_dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"UTC"]];
        [_dateFormatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SSS'Z'"];

    }
    return self;
}

-(BOOL) userInformationValidatesWithEmail:(NSString*)emailAddress andPassword:(NSString*)password {

    return YES;

}

-(void) attemptToCreateUserWithEmail:(NSString*)emailAddress
                                         andPassword:(NSString *)password
                                      andDisplayName:(NSString *)displayName
                                      withCompletion:(RDMTeacherAccountSubmissionCompletionBlock)completionBlock {

    NSMutableURLRequest *urlRequest = [self.loginAPIClient signupAccountRequestWithEmail:emailAddress
                                                                             andPassword:password
                                                                          andDisplayName:displayName];

    void (^successBlock)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {

        NSLog(@"Response Object: %@", responseObject);
        NSString *token = [responseObject objectForKey:@"token"];
        NSDictionary *userDictionary = [responseObject objectForKey:@"user"];

        if (self.dataController.currentUser) {

            [self.dataController.managedObjectContext deleteObject:self.dataController.currentUser];
            self.dataController.currentUser = nil;
            [[NSNotificationCenter defaultCenter] postNotificationName:RDMUserDidChangeNotification object:nil];

        }

        RDMUser *user = [self setupUserWithUserDictionary:userDictionary
                                                 andToken:token];

        [self.dataController saveMainContextWithCompletion:^(NSError *error) {

            [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert)];

            if (error) {
                NSLog(@"Error: %@", error);
            }

            if (completionBlock) {
                completionBlock(user, nil);
            }

            [[NSNotificationCenter defaultCenter] postNotificationName:RDMUserDidChangeNotification object:user];
        }];
    };

    void (^failureBlock)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {

        NSHTTPURLResponse *response = [error userInfo][AFNetworkingOperationFailingURLResponseErrorKey];

        NSDictionary *userInfo;
        switch (response.statusCode) {
            case 406:
                userInfo = @{ @"RDMErrorTitleKey": @"Please Upgrade",
                              NSLocalizedDescriptionKey : @"It looks like this version of the app is out of date. Please upgrade to the latest version through the App Store." };
                break;
            case 409:
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Create Account",
                              NSLocalizedDescriptionKey : @"This email address is already being used." };
                break;
            case 500:
            default:
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Create Account",
                              NSLocalizedDescriptionKey : @"There appears to be something wrong with the server. Please try again." };
                break;
        }

        NSError *localError = [NSError errorWithDomain:@"com.lunchboxapps"
                                                  code:response.statusCode
                                              userInfo:userInfo];

        NSLog(@"Error: %@", error);
        if (completionBlock) {
            completionBlock(nil, localError);
        }

    };

    AFHTTPRequestOperation *operation = [self.loginAPIClient HTTPRequestOperationWithRequest:urlRequest
                                                                                success:successBlock
                                                                                failure:failureBlock];
    [operation start];

}

-(void) attemptToLoginUserWithEmail:(NSString*)emailAddress andPassword:(NSString*)password withCompletion:(RDMTeacherAccountSubmissionCompletionBlock)completionBlock {

    NSMutableURLRequest *urlRequest = [self.loginAPIClient loginAccountRequestWithEmail:emailAddress
                                                                            andPassword:password];

    void (^successBlock)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {

        NSLog(@"Response Object: %@", responseObject);
        NSString *token = [responseObject objectForKey:@"token"];
        NSDictionary *userDictionary = [responseObject objectForKey:@"user"];

        if (self.dataController.currentUser != nil && [self.dataController.currentUser.guid isEqualToString:[userDictionary objectForKey:@"_id"]]) {
            //We already have this user

            self.dataController.currentUser.emailAddress = [userDictionary objectForKey:@"emailAddress"];
            self.dataController.currentUser.displayName = [userDictionary objectForKey:@"displayName"];
            self.dataController.currentUser.registrationToken = [userDictionary objectForKey:@"registrationToken"];

            if (!userDictionary[@"subscriptionExpirationDate"] || userDictionary[@"subscriptionExpirationDate"] == [NSNull null]) {
                self.dataController.currentUser.subscriptionExpirationDate = nil;
            } else {
                self.dataController.currentUser.subscriptionExpirationDate = [self.dateFormatter dateFromString:userDictionary[@"subscriptionExpirationDate"]];
            }

            [self.dataController.currentUser setServerToken:token];

            [self.dataController saveMainContextWithCompletion:^(NSError *error) {

                if (error) {
                    NSLog(@"Error: %@", error);
                }

                [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert)];

                if (completionBlock) {
                    completionBlock(self.dataController.currentUser, nil);
                }
            }];

            return;
        }

        if (self.dataController.currentUser) {

            [self.dataController.managedObjectContext deleteObject:self.dataController.currentUser];
            self.dataController.currentUser = nil;
            [[NSNotificationCenter defaultCenter] postNotificationName:RDMUserDidChangeNotification object:nil];

        }

        RDMUser *user = [self setupUserWithUserDictionary:userDictionary andToken:token];

        [self.dataController saveMainContextWithCompletion:^(NSError *error) {

            [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert)];

            if (error) {
                NSLog(@"Error: %@", error);
            }

            if (completionBlock) {
                completionBlock(user, nil);
            }

            [[NSNotificationCenter defaultCenter] postNotificationName:RDMUserDidChangeNotification object:user];

        }];

    };

    void (^failureBlock)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {

        NSHTTPURLResponse *response = [error userInfo][AFNetworkingOperationFailingURLResponseErrorKey];

        NSDictionary *userInfo;
        switch (response.statusCode) {
            case 401:
            case 404:
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Login",
                              NSLocalizedDescriptionKey : @"Could not find a matching username and password." };
                break;
            case 406:
                userInfo = @{ @"RDMErrorTitleKey": @"Please Upgrade",
                              NSLocalizedDescriptionKey : @"It looks like this version of the app is out of date. Please upgrade to the latest version through the App Store." };
                break;
            case 500:
            default:
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Login",
                              NSLocalizedDescriptionKey : @"There appears to be something wrong with the server. Please try again." };
                break;
        }

        NSError *localError = [NSError errorWithDomain:@"com.lunchboxapps"
                                                  code:response.statusCode
                                              userInfo:userInfo];

        NSLog(@"Error: %@", error);
        if (completionBlock) {
            completionBlock(nil, localError);
        }

    };

    AFHTTPRequestOperation *operation = [self.loginAPIClient HTTPRequestOperationWithRequest:urlRequest
                                                                                success:successBlock
                                                                                failure:failureBlock];
    [operation start];

}

-(RDMUser *)setupUserWithUserDictionary:(NSDictionary*)userDictionary andToken:(NSString*)token {

    RDMUser *user = [NSEntityDescription insertNewObjectForEntityForName:@"RDMUser"
                                                  inManagedObjectContext:self.dataController.managedObjectContext];
    user.emailAddress = [userDictionary objectForKey:@"emailAddress"];
    user.displayName = [userDictionary objectForKey:@"displayName"];
    user.guid = [userDictionary objectForKey:@"_id"];

    if (!userDictionary[@"subscriptionExpirationDate"] || userDictionary[@"subscriptionExpirationDate"] == [NSNull null]) {
        user.subscriptionExpirationDate = nil;
    } else {
        user.subscriptionExpirationDate = [self.dateFormatter dateFromString:userDictionary[@"subscriptionExpirationDate"]];
    }

    user.registrationToken = [userDictionary objectForKey:@"registrationToken"];
    [user setServerToken:token];
    return user;
}

-(void) sendPasswordResetRequestWithEmail:(NSString*)emailAddress withCompletion:(RDMTeacherAccountPasswordResetRequestCompletionBlock)completionBlock {

    NSMutableURLRequest *urlRequest = [self.loginAPIClient requestPasswordResetRequestWithEmail:emailAddress];

    void (^successBlock)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {

        NSLog(@"Response Object: %@", responseObject);
        if (completionBlock) {
            completionBlock(nil);
        }

    };

    void (^failureBlock)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {

        NSHTTPURLResponse *response = [error userInfo][AFNetworkingOperationFailingURLResponseErrorKey];

        NSDictionary *userInfo;
        switch (response.statusCode) {
            case 406:
                userInfo = @{ @"RDMErrorTitleKey": @"Please Upgrade",
                              NSLocalizedDescriptionKey : @"It looks like this version of the app is out of date. Please upgrade to the latest version through the App Store." };
                break;
            case 500:
            default:
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Send Password Reset",
                              NSLocalizedDescriptionKey : @"There appears to be something wrong with the server. Please try again." };
                break;
        }

        NSError *localError = [NSError errorWithDomain:@"com.lunchboxapps"
                                                  code:response.statusCode
                                              userInfo:userInfo];

        NSLog(@"Error: %@", error);
        if (completionBlock) {
            completionBlock(localError);
        }

    };

    AFHTTPRequestOperation *operation = [self.loginAPIClient HTTPRequestOperationWithRequest:urlRequest
                                                                                success:successBlock
                                                                                failure:failureBlock];
    [operation start];

}

-(void) sendPasswordResetConfirmationWithCode:(NSString*)resetCode andNewPassword:(NSString*)newPassword withCompletion:(RDMTeacherAccountSubmissionCompletionBlock)completionBlock {

    NSMutableURLRequest *urlRequest = [self.loginAPIClient confirmPasswordResetRequestWithResetCode:resetCode
                                                                                andNewPassword:newPassword];

    void (^successBlock)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {

        NSLog(@"Response Object: %@", responseObject);
        NSString *token = [responseObject objectForKey:@"token"];
        NSDictionary *userDictionary = [responseObject objectForKey:@"user"];

        if (self.dataController.currentUser != nil && [self.dataController.currentUser.guid isEqualToString:[userDictionary objectForKey:@"_id"]]) {
            //We already have this user

            self.dataController.currentUser.emailAddress = [userDictionary objectForKey:@"emailAddress"];
            self.dataController.currentUser.displayName = [userDictionary objectForKey:@"displayName"];
            self.dataController.currentUser.registrationToken = [userDictionary objectForKey:@"registrationToken"];
            if (!userDictionary[@"subscriptionExpirationDate"] || userDictionary[@"subscriptionExpirationDate"] == [NSNull null]) {
                self.dataController.currentUser.subscriptionExpirationDate = nil;
            } else {
                self.dataController.currentUser.subscriptionExpirationDate = [self.dateFormatter dateFromString:userDictionary[@"subscriptionExpirationDate"]];
            }            [self.dataController.currentUser setServerToken:token];

            [self.dataController saveMainContextWithCompletion:^(NSError *error) {

                if (error) {
                    NSLog(@"Error: %@", error);
                }

                if (completionBlock) {
                    completionBlock(self.dataController.currentUser, nil);
                }
            }];

            return;
        }

        if (self.dataController.currentUser) {

            [self.dataController.managedObjectContext deleteObject:self.dataController.currentUser];
            self.dataController.currentUser = nil;
            [[NSNotificationCenter defaultCenter] postNotificationName:RDMUserDidChangeNotification object:nil];

        }

        RDMUser *user = [self setupUserWithUserDictionary:userDictionary andToken:token];

        [self.dataController saveMainContextWithCompletion:^(NSError *error) {

            if (error) {
                NSLog(@"Error: %@", error);
            }

            if (completionBlock) {
                completionBlock(user, nil);
            }
            [[NSNotificationCenter defaultCenter] postNotificationName:RDMUserDidChangeNotification object:user];

        }];

    };

    void (^failureBlock)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {

        NSHTTPURLResponse *response = [error userInfo][AFNetworkingOperationFailingURLResponseErrorKey];

        NSDictionary *userInfo;
        switch (response.statusCode) {
            case 401:
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Reset Password",
                              NSLocalizedDescriptionKey : @"This password reset code has expired for your security. Please request a new password reset and try again." };
                break;
            case 404:
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Reset Password",
                              NSLocalizedDescriptionKey : @"This does not appear to be a valid password reset code." };
                break;
            case 406:
                userInfo = @{ @"RDMErrorTitleKey": @"Please Upgrade",
                              NSLocalizedDescriptionKey : @"It looks like this version of the app is out of date. Please upgrade to the latest version through the App Store." };
                break;
            case 500:
            default:
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Reset Password",
                              NSLocalizedDescriptionKey : @"There appears to be something wrong with the server. Please try again." };
                break;
        }

        NSError *localError = [NSError errorWithDomain:@"com.lunchboxapps"
                                                  code:response.statusCode
                                              userInfo:userInfo];

        NSLog(@"Error: %@", error);
        if (completionBlock) {
            completionBlock(nil, localError);
        }

    };

    AFHTTPRequestOperation *operation = [self.loginAPIClient HTTPRequestOperationWithRequest:urlRequest
                                                                                success:successBlock
                                                                                failure:failureBlock];
    [operation start];

}

-(void) sendPasswordChangeWithEmail:(NSString*)emailAddress andOldPassword:(NSString*)oldPassword andNewPassword:(NSString*)newPassword andCompletion:(RDMTeacherAccountSubmissionCompletionBlock)completionBlock {

    NSMutableURLRequest *urlRequest = [self.loginAPIClient changePasswordRequestWithEmailAddress:emailAddress
                                                                                andOldPassword:oldPassword
                                                                                andNewPassword:newPassword
                                                                                andLogoutDevices:NO];

    void (^successBlock)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {

        NSLog(@"Response Object: %@", responseObject);
        NSString *token = [responseObject objectForKey:@"token"];
        NSDictionary *userDictionary = [responseObject objectForKey:@"user"];

        if (self.dataController.currentUser != nil && [self.dataController.currentUser.guid isEqualToString:[userDictionary objectForKey:@"_id"]]) {
            //We already have this user

            self.dataController.currentUser.emailAddress = [userDictionary objectForKey:@"emailAddress"];
            self.dataController.currentUser.displayName = [userDictionary objectForKey:@"displayName"];
            self.dataController.currentUser.registrationToken = [userDictionary objectForKey:@"registrationToken"];
            if (!userDictionary[@"subscriptionExpirationDate"] || userDictionary[@"subscriptionExpirationDate"] == [NSNull null]) {
                self.dataController.currentUser.subscriptionExpirationDate = nil;
            } else {
                self.dataController.currentUser.subscriptionExpirationDate = [self.dateFormatter dateFromString:userDictionary[@"subscriptionExpirationDate"]];
            }
            [self.dataController.currentUser setServerToken:token];

            [self.dataController saveMainContextWithCompletion:^(NSError *error) {

                if (error) {
                    NSLog(@"Error: %@", error);
                }

                if (completionBlock) {
                    completionBlock(self.dataController.currentUser, nil);
                }
            }];

            return;
        }

        NSLog(@"Got a different user — shouldn't happen");

    };

    void (^failureBlock)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {

        NSHTTPURLResponse *response = [error userInfo][AFNetworkingOperationFailingURLResponseErrorKey];

        NSDictionary *userInfo;
        switch (response.statusCode) {
            case 401:
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Change Password",
                              NSLocalizedDescriptionKey : @"Please make sure you have the correct current password." };
                break;
            case 406:
                userInfo = @{ @"RDMErrorTitleKey": @"Please Upgrade",
                              NSLocalizedDescriptionKey : @"It looks like this version of the app is out of date. Please upgrade to the latest version through the App Store." };
                break;
            case 500:
            default:
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Change Password",
                              NSLocalizedDescriptionKey : @"There appears to be something wrong with the server. Please try again." };
                break;
        }

        NSError *localError = [NSError errorWithDomain:@"com.lunchboxapps"
                                                  code:response.statusCode
                                              userInfo:userInfo];

        NSLog(@"Error: %@", error);
        if (completionBlock) {
            completionBlock(nil, localError);
        }

    };

    AFHTTPRequestOperation *operation = [self.loginAPIClient HTTPRequestOperationWithRequest:urlRequest
                                                                                success:successBlock
                                                                                failure:failureBlock];
    [operation start];

}

-(void) sendDisplayNameChange:(NSString*)newDisplayName withCompletion:(RDMTeacherAccountSubmissionCompletionBlock)completionBlock {

    NSMutableURLRequest *urlRequest = [self.tokenBasedAPIClient changeDisplayNameRequestForUserWithToken:self.dataController.currentUser.serverToken
                                                                                withNewDisplayName:newDisplayName];

    if (!urlRequest) {

        [[NSNotificationCenter defaultCenter] postNotificationName:@"RDMDidReceive401WithTokenBasedAuthentication" object:nil];
        [UIAlertView showAlertWithTitle:@"Error" andMessage:@"There was a problem syncing your account. Please sign in again."];

        return;
    }

    void (^successBlock)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {

        NSLog(@"Response Object: %@", responseObject);
        NSDictionary *userDictionary = responseObject;

        if (self.dataController.currentUser != nil && [self.dataController.currentUser.guid isEqualToString:[userDictionary objectForKey:@"_id"]]) {
            //We already have this user

            self.dataController.currentUser.emailAddress = [userDictionary objectForKey:@"emailAddress"];
            self.dataController.currentUser.displayName = [userDictionary objectForKey:@"displayName"];
            self.dataController.currentUser.registrationToken = [userDictionary objectForKey:@"registrationToken"];
            if (!userDictionary[@"subscriptionExpirationDate"] || userDictionary[@"subscriptionExpirationDate"] == [NSNull null]) {
                self.dataController.currentUser.subscriptionExpirationDate = nil;
            } else {
                self.dataController.currentUser.subscriptionExpirationDate = [self.dateFormatter dateFromString:userDictionary[@"subscriptionExpirationDate"]];
            }

            [self.dataController saveMainContextWithCompletion:^(NSError *error) {

                if (error) {
                    NSLog(@"Error: %@", error);
                }

                if (completionBlock) {
                    completionBlock(self.dataController.currentUser, nil);
                }
            }];

            return;
        }

        NSLog(@"Got a different user — shouldn't happen");

    };

    void (^failureBlock)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {

        NSHTTPURLResponse *response = [error userInfo][AFNetworkingOperationFailingURLResponseErrorKey];

        NSDictionary *userInfo;
        switch (response.statusCode) {
            case 401:
                [[NSNotificationCenter defaultCenter] postNotificationName:@"RDMDidReceive401WithTokenBasedAuthentication" object:nil];
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Change Display Name",
                              NSLocalizedDescriptionKey : @"There was a problem logging into your account. Please sign in again." };
                break;
            case 406:
                userInfo = @{ @"RDMErrorTitleKey": @"Please Upgrade",
                              NSLocalizedDescriptionKey : @"It looks like this version of the app is out of date. Please upgrade to the latest version through the App Store." };
                break;
            case 500:
            default:
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Change Display Name",
                              NSLocalizedDescriptionKey : @"There appears to be something wrong with the server. Please try again." };
                break;
        }

        NSError *localError = [NSError errorWithDomain:@"com.lunchboxapps"
                                                  code:response.statusCode
                                              userInfo:userInfo];

        NSLog(@"Error: %@", error);
        if (completionBlock) {
            completionBlock(nil, localError);
        }

    };

    AFHTTPRequestOperation *operation = [self.loginAPIClient HTTPRequestOperationWithRequest:urlRequest
                                                                                success:successBlock
                                                                                failure:failureBlock];
    [operation start];

}

-(void) logoutUserWithCompletion:(RDMTeacherAccountSubmissionCompletionBlock)completion {

    if (self.dataController.currentUser.serverToken && [self.dataController.currentUser usersDeviceToken]) {

        //Attempt to remove device token
        NSMutableURLRequest *urlRequest = [self.tokenBasedAPIClient sendLogoutRequestForUserWithToken:self.dataController.currentUser.serverToken
                                                                                withDeviceToken:[self.dataController.currentUser usersDeviceToken]];

        if (!urlRequest) {

            [[NSNotificationCenter defaultCenter] postNotificationName:@"RDMDidReceive401WithTokenBasedAuthentication" object:nil];
            [UIAlertView showAlertWithTitle:@"Error" andMessage:@"There was a problem syncing your account. Please sign in again."];

            return;
        }

        void (^successBlock)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {

        };

        void (^failureBlock)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {

        };

        AFHTTPRequestOperation *operation = [self.loginAPIClient HTTPRequestOperationWithRequest:urlRequest
                                                                                success:successBlock
                                                                                failure:failureBlock];
        [operation start];
    }

    [self.dataController.managedObjectContext deleteObject:self.dataController.currentUser];
    self.dataController.currentUser = nil;

    [[NSUserDefaults standardUserDefaults] setObject:@NO forKey:@"RDM_HAS_BOTHERED_USER_ABOUT_SUBSCRIPTION_ON_THIS_DEVICE"];
    [[NSUserDefaults standardUserDefaults] synchronize];

    [self.dataController saveMainContextWithCompletion:^(NSError *error) {

        if (completion) {
            completion(nil, nil);
        }

        [[NSNotificationCenter defaultCenter] postNotificationName:RDMUserDidChangeNotification object:nil];

    }];

}

-(void) sendRegistrationTokenChangeRequestWithCompletion:(RDMTeacherAccountSubmissionCompletionBlock)completionBlock {

    NSMutableURLRequest *urlRequest = [self.tokenBasedAPIClient sendRegistrationCodeChangeRequest:self.dataController.currentUser.serverToken];

    if (!urlRequest) {

        [[NSNotificationCenter defaultCenter] postNotificationName:@"RDMDidReceive401WithTokenBasedAuthentication" object:nil];
        [UIAlertView showAlertWithTitle:@"Error" andMessage:@"There was a problem syncing your account. Please sign in again."];

        return;
    }

    void (^successBlock)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {

        NSLog(@"Response Object: %@", responseObject);
        NSDictionary *userDictionary = responseObject;

        if (self.dataController.currentUser != nil && [self.dataController.currentUser.guid isEqualToString:[userDictionary objectForKey:@"_id"]]) {
            //We already have this user

            self.dataController.currentUser.registrationToken = [userDictionary objectForKey:@"registrationToken"];

            [self.dataController saveMainContextWithCompletion:^(NSError *error) {

                if (error) {
                    NSLog(@"Error: %@", error);
                }

                if (completionBlock) {
                    completionBlock(self.dataController.currentUser, nil);
                }
            }];

            return;
        }

        NSLog(@"Got a different user — shouldn't happen");

    };

    void (^failureBlock)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {

        NSHTTPURLResponse *response = [error userInfo][AFNetworkingOperationFailingURLResponseErrorKey];

        NSDictionary *userInfo;
        switch (response.statusCode) {
            case 406:
                userInfo = @{ @"RDMErrorTitleKey": @"Please Upgrade",
                              NSLocalizedDescriptionKey : @"It looks like this version is out of date. Please upgrade to the latest version through the App Store." };
                break;
            case 500:
            default:
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Change Registration Code",
                              NSLocalizedDescriptionKey : @"There appears to be something wrong with the server. Please try again." };
                break;
        }

        NSError *localError = [NSError errorWithDomain:@"com.lunchboxapps"
                                                  code:response.statusCode
                                              userInfo:userInfo];

        NSLog(@"Error: %@", error);
        if (completionBlock) {
            completionBlock(nil, localError);
        }

    };

    AFHTTPRequestOperation *operation = [self.tokenBasedAPIClient HTTPRequestOperationWithRequest:urlRequest
                                                                                success:successBlock
                                                                                failure:failureBlock];
    [operation start];
}

-(void) sendGroupRegistrationTokenChangeRequestForGroup:(RDMGroup*)group
                                         WithCompletion:(RDMTeacherAccountGroupRegistrationCodeChangeCompletionBlock)completionBlock {

    NSMutableURLRequest *urlRequest = [self.tokenBasedAPIClient sendGroupRegistrationCodeChangeRequestWithToken:self.dataController.currentUser.serverToken
                                                                                forGroupWithGUID:group.guid];

    if (!urlRequest) {

        [[NSNotificationCenter defaultCenter] postNotificationName:@"RDMDidReceive401WithTokenBasedAuthentication" object:nil];
        [UIAlertView showAlertWithTitle:@"Error" andMessage:@"There was a problem syncing your account. Please sign in again."];

        return;
    }

    void (^successBlock)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {

        NSLog(@"Response Object: %@", responseObject);
        NSDictionary *groupDictionary = responseObject;

        group.registrationToken = groupDictionary[@"registrationToken"];

            [self.dataController saveMainContextWithCompletion:^(NSError *error) {

                if (error) {
                    NSLog(@"Error: %@", error);
                    if (completionBlock) {
                        completionBlock(nil, error);
                    }
                }

                if (completionBlock) {
                    completionBlock(group, nil);
                }
            }];

    };

    void (^failureBlock)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {

        NSHTTPURLResponse *response = [error userInfo][AFNetworkingOperationFailingURLResponseErrorKey];

        NSDictionary *userInfo;
        switch (response.statusCode) {
            case 404:
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Change Registration Code",
                              NSLocalizedDescriptionKey : @"Could not find this group. It may have been deleted." };
                break;
            case 406:
                userInfo = @{ @"RDMErrorTitleKey": @"Please Upgrade",
                              NSLocalizedDescriptionKey : @"It looks like this version is out of date. Please upgrade to the latest version through the App Store." };
                break;
            case 500:
            default:
                userInfo = @{ @"RDMErrorTitleKey": @"Could Not Change Registration Code",
                              NSLocalizedDescriptionKey : @"There appears to be something wrong with the server. Please try again." };
                break;
        }

        NSError *localError = [NSError errorWithDomain:@"com.lunchboxapps"
                                                  code:response.statusCode
                                              userInfo:userInfo];

        NSLog(@"Error: %@", error);
        if (completionBlock) {
            completionBlock(nil, localError);
        }

    };

    AFHTTPRequestOperation *operation = [self.tokenBasedAPIClient HTTPRequestOperationWithRequest:urlRequest
                                                                                success:successBlock
                                                                                failure:failureBlock];
    [operation start];

}

@end


text:
package process

import (
	"testing"
)

// TestExecutableNameWindows tests that ExecutableName works correctly for a
// Windows target.
func TestExecutableNameWindows(t *testing.T) {
	if name := ExecutableName("mutagen-agent", "windows"); name != "mutagen-agent.exe" {
		t.Error("executable name incorrect for Windows")
	}
}

// TestExecutableNameLinux tests that ExecutableName works correctly for a Linux
// target.
func TestExecutableNameLinux(t *testing.T) {
	if name := ExecutableName("mutagen-agent", "linux"); name != "mutagen-agent" {
		t.Error("executable name incorrect for Linux")
	}
}

redpajama_set_name: RedPajamaGithub


text:
import path from 'path';
import lodash from 'lodash';
import component from './component.json';

function constructComponent(source, name) {
  return lodash(source[name])
    .map((file) => [
      file,
      require(path.resolve(__dirname, name, file)), // eslint-disable-line global-require
    ])
    .fromPairs()
    .value();
}

export const availableParsers = constructComponent(component, 'parser');

export const availableDetectors = constructComponent(component, 'detector');

export const availableSpecials = constructComponent(component, 'special');

export const defaultOptions = {
  ignoreBinPackage: false,
  ignoreMatches: [],
  ignorePatterns: [
    '.git',
    '.svn',
    '.hg',
    '.idea',
    'node_modules',
    'bower_components',
    // Images
    '*.png',
    '*.gif',
    '*.jpg',
    '*.jpeg',
    '*.svg',
    // Fonts
    '*.woff',
    '*.woff2',
    '*.eot',
    '*.ttf',
    // Archives
    '*.zip',
    '*.gz',
    // Videos
    '*.mp4',
  ],
  skipMissing: false,
  parsers: {
    '**/*.js': availableParsers.jsx,
    '**/*.jsx': availableParsers.jsx,
    '**/*.coffee': availableParsers.coffee,
    '**/*.litcoffee': availableParsers.coffee,
    '**/*.coffee.md': availableParsers.coffee,
    '**/*.graphql': availableParsers.graphql,
    '**/*.ts': availableParsers.typescript,
    '**/*.tsx': availableParsers.typescript,
    '**/*.sass': availableParsers.sass,
    '**/*.scss': availableParsers.sass,
    '**/*.vue': availableParsers.vue,
    '**/*.svelte': availableParsers.svelte,
  },
  detectors: [
    availableDetectors.importDeclaration,
    availableDetectors.exportDeclaration,
    availableDetectors.requireCallExpression,
    availableDetectors.requireResolveCallExpression,
    availableDetectors.typescriptImportEqualsDeclaration,
    availableDetectors.importCallExpression,
    availableDetectors.gruntLoadTaskCallExpression,
  ],
  specials: lodash.values(availableSpecials),
};


text:
Help::Help() :
  io( IOManager::getInstance() ),
  words(),
  position(),
  space()
{
  unsigned int n = Gamedata::getInstance()->getXmlInt("helpNumber");
  position[0] = Gamedata::getInstance()->getXmlInt("helpX");
  position[1] = Gamedata::getInstance()->getXmlInt("helpY");
  std::stringstream strm;
  for ( unsigned i = 0; i < n; ++i ) {
    strm << "help" << i;
    words.push_back( Gamedata::getInstance()->getXmlStr(strm.str()) );
    strm.clear(); // clear error flags
    strm.str(std::string()); // clear contents
  }

  space[0] = Gamedata::getInstance()->getXmlInt("helpSpaceX");
  space[1] = Gamedata::getInstance()->getXmlInt("helpSpaceY");
}

void Help::update(Uint32){
}

void Help::draw() const {
  int y = position[1];
    io.printMessageCenteredAt(Gamedata::getInstance()->getXmlStr("helpTitle"), y, "large");
    y += 2*space[1];
  for (unsigned i = 0; i < words.size(); ++i) {
    io.printMessageCenteredAt(words[i], y, "smaller");
    y += space[1];
  }
}


text:
module MongoMapper
  module Plugins
    module Associations
      class OneAsProxy < OneProxy
        protected
          def criteria
            {type_key_name => proxy_owner.class.name, id_key_name => proxy_owner.id}
          end

        private
          def type_key_name
            "#{options[:as]}_type"
          end

          def id_key_name
            "#{options[:as]}_id"
          end
      end
    end
  end
end


text: return require("ui/program")


text:
function res = gray2rgb(img, map)

%%Convert grayscale images to RGB using specified colormap.
%	IMG is the grayscale image. Must be specified as a name of the image
%	including the directory, or the matrix.
%	MAP is the M-by-3 matrix of colors.
%
%	RES = GRS2RGB(IMG) produces the RGB image RES from the grayscale image IMG
%	using the colormap HOT with 64 colors.
%
%	RES = GRS2RGB(IMG,MAP) produces the RGB image RES from the grayscale image
%	IMG using the colormap matrix MAP. MAP must contain 3 columns for Red,
%	Green, and Blue components.
%
%	Example 1:
%	open 'image.tif';
%	res = grs2rgb(image);
%
%	Example 2:
%	cmap = colormap(summer);
% 	res = grs2rgb('image.tif',cmap);
%
% 	See also COLORMAP, HOT
%
%	Written by
%	Valeriy R. Korostyshevskiy, PhD
%	Georgetown University Medical Center
%	Washington, D.C.
%	December 2006
%
% 	vrk@georgetown.edu

% Check the arguments
if nargin<1
	error('grs2rgb:missingImage','Specify the name or the matrix of the image');
end;

if ~exist('map','var') || isempty(map)
	%map = hot(64);
    map = jet(64);
end;

[l,w] = size(map);

if w~=3
	error('grs2rgb:wrongColormap','Colormap matrix must contain 3 columns');
end;

if ischar(img)
	a = imread(img);
elseif isnumeric(img)
	a = img;
else
	error('grs2rgb:wrongImageFormat','Image format: must be name or matrix');
end;

% Calculate the indices of the colormap matrix
a = double(a);
a(a==0) = 1; % Needed to produce nonzero index of the colormap matrix
ci = ceil(l*a/max(a(:)));

% Colors in the new image
[il,iw] = size(a);
r = zeros(il,iw);
g = zeros(il,iw);
b = zeros(il,iw);
r(:) = map(ci,1);
g(:) = map(ci,2);
b(:) = map(ci,3);

% New image
res = zeros(il,iw,3);
res(:,:,1) = r;
res(:,:,2) = g;
res(:,:,3) = b;


text:
* Update `pay_android` to `1.0.8`, which includes the new specification for the Google Pay button.

## 1.0.10 (2022-06-01)

* Update `pay_ios` to `1.0.7`, which adds the `transactionIdentifier` property to the payment result.

## 1.0.9 (2022-05-24)

* Add support for Flutter 3 in the sample application.
* Update `pay_android` to `1.0.7`, which adds support for Flutter 3 to the package.

## 1.0.8 (2022-01-31)

* Update `pay_ios` to `1.0.6`, which adds `postalAddress` to the payment result.

## 1.0.7 (2022-01-04)

* Update `pay_android` to `1.0.6`, which uses a stable version of `flutter_svg`.

## 1.0.6 (2021-10-04)

### Features
* Make the package available for iOS versions lower than 12.0 ([#36](https://github.com/google-pay/flutter-plugin/issues/36)).
* Capture the dismissal of the payment selector and expose it to the Flutter end through the `onError` callback ([#90](https://github.com/google-pay/flutter-plugin/issues/90), [#61](https://github.com/google-pay/flutter-plugin/issues/61)).

### Fixes
* Fix not being able to capture a payment result on the second and further payment attempts ([#80](https://github.com/google-pay/flutter-plugin/issues/80)).

## 1.0.5 (2021-06-08)

### Fixes

* Expose the `PaymentConfiguration` class through the `pay` package ([#53](https://github.com/google-pay/flutter-plugin/issues/53)).
* Fix incorrect `late init` use at initialization time for the `Pay` class ([#54](https://github.com/google-pay/flutter-plugin/issues/54)).

## 1.0.4 (2021-06-01)
Enrich `dartdoc` comments to facilitate the adoption of the package.

## 1.0.3 (2021-05-26)

### Fixes

* Fix incorrect handling of billing and shipping addresses for Apple Pay.

## 1.0.2 (2021-05-25)

* Update dependencies.

### Fixes

* Correctly flag the package as a plugin.

## 1.0.1 (2021-05-18)

### Fixes

* Updated the guide in the readme.

## 1.0.0 (2021-05-10)
Initial release of this plugin.

### Features

* Support for Apple Pay and Google Pay.
* Two integration paths: a set of simple drop-and-go widgets, and separate classes to create custom integrations.
* Support for multiple payment providers for a single platform.
* Support for the languages supported by the payment providers.


text:
<!DOCTYPE HTML>

		<meta http-equiv="Content-Type" content="html/html; charset=utf-8" />
		<title>AcceptTransaction Class Reference</title>
		<meta id="xcode-display" name="xcode-display" content="render"/>
		<link rel="stylesheet" type="text/css" href="../css/styles.css" media="all" />
		<link rel="stylesheet" type="text/css" media="print" href="../css/stylesPrint.css" />
		<meta name="generator" content="appledoc 2.2 (build 963)" />

acceptSDK

				Wirecard

AcceptTransaction Class Reference

					<button aria-label="Show Table of Contents" role="checkbox" class="open" id="table_of_contents">Table of Contents</button>

					<select id="jumpTo">
	<option value="top">Jump To…</option>

	<option value="overview">Overview</option>

	<option value="tasks">Tasks</option>

	<option value="properties">Properties</option>

	<option value="//api/name/additionalInfo">    additionalInfo</option>

	<option value="//api/name/amount">    amount</option>

	<option value="//api/name/bankCode">    bankCode</option>

	<option value="//api/name/capturable">    capturable</option>

	<option value="//api/name/cardHolderFirstName">    cardHolderFirstName</option>

	<option value="//api/name/cardHolderLastName">    cardHolderLastName</option>

	<option value="//api/name/cardNumber">    cardNumber</option>

	<option value="//api/name/cardType">    cardType</option>

	<option value="//api/name/cnpApplicationId">    cnpApplicationId</option>

	<option value="//api/name/cnpApplicationLabel">    cnpApplicationLabel</option>

	<option value="//api/name/cnpAuthorizationCode">    cnpAuthorizationCode</option>

	<option value="//api/name/cnpAuthorizationNumber">    cnpAuthorizationNumber</option>

	<option value="//api/name/cnpIssuerResponseCode">    cnpIssuerResponseCode</option>

	<option value="//api/name/cnpMerchantId">    cnpMerchantId</option>

	<option value="//api/name/cnpTerminalId">    cnpTerminalId</option>

	<option value="//api/name/cnpTransactionCertificate">    cnpTransactionCertificate</option>

	<option value="//api/name/cnpTsi">    cnpTsi</option>

	<option value="//api/name/cnpTvr">    cnpTvr</option>

	<option value="//api/name/countryCode">    countryCode</option>

	<option value="//api/name/createdAt">    createdAt</option>

	<option value="//api/name/currency">    currency</option>

	<option value="//api/name/deviceType">    deviceType</option>

	<option value="//api/name/emailReceipt">    emailReceipt</option>

	<option value="//api/name/emvTransactionType">    emvTransactionType</option>

	<option value="//api/name/errorCode">    errorCode</option>

	<option value="//api/name/expectsTC">    expectsTC</option>

	<option value="//api/name/gatewayLive">    gatewayLive</option>

	<option value="//api/name/gatewayLogin">    gatewayLogin</option>

	<option value="//api/name/gatewayPassword">    gatewayPassword</option>

	<option value="//api/name/gatewaySignature">    gatewaySignature</option>

	<option value="//api/name/gratuityType">    gratuityType</option>

	<option value="//api/name/guwid">    guwid</option>

	<option value="//api/name/issuerScript">    issuerScript</option>

	<option value="//api/name/items">    items</option>

	<option value="//api/name/lat">    lat</option>

	<option value="//api/name/lng">    lng</option>

	<option value="//api/name/location">    location</option>

	<option value="//api/name/merchantId">    merchantId</option>

	<option value="//api/name/note">    note</option>

	<option value="//api/name/processedAt">    processedAt</option>

	<option value="//api/name/receiptRequested">    receiptRequested</option>

	<option value="//api/name/referenceId">    referenceId</option>

	<option value="//api/name/refundable">    refundable</option>

	<option value="//api/name/refunds">    refunds</option>

	<option value="//api/name/reversals">    reversals</option>

	<option value="//api/name/reversible">    reversible</option>

	<option value="//api/name/serviceChargeAmount">    serviceChargeAmount</option>

	<option value="//api/name/serviceChargeHidden">    serviceChargeHidden</option>

	<option value="//api/name/signature">    signature</option>

	<option value="//api/name/state">    state</option>

	<option value="//api/name/status">    status</option>

	<option value="//api/name/tax">    tax</option>

	<option value="//api/name/taxHidden">    taxHidden</option>

	<option value="//api/name/technicalMessage">    technicalMessage</option>

	<option value="//api/name/tip">    tip</option>

	<option value="//api/name/tipTaxRate">    tipTaxRate</option>

	<option value="//api/name/transactionType">    transactionType</option>

	<option value="//api/name/txNumber">    txNumber</option>

	<option value="//api/name/type">    type</option>

	<option value="//api/name/uniqueId">    uniqueId</option>

</select>

Overview

Tasks

Properties

additionalInfo

amount

bankCode

capturable

cardHolderFirstName

cardHolderLastName

cardNumber

cardType

cnpApplicationId

cnpApplicationLabel

cnpAuthorizationCode

cnpAuthorizationNumber

cnpIssuerResponseCode

cnpMerchantId

cnpTerminalId

cnpTransactionCertificate

cnpTsi

cnpTvr

countryCode

createdAt

currency

deviceType

emailReceipt

emvTransactionType

errorCode

expectsTC

gatewayLive

gatewayLogin

gatewayPassword

gatewaySignature

gratuityType

guwid

issuerScript

items

lat

lng

location

merchantId

note

processedAt

receiptRequested

referenceId

refundable

refunds

reversals

reversible

serviceChargeAmount

serviceChargeHidden

signature

state

status

tax

taxHidden

technicalMessage

tip

tipTaxRate

transactionType

txNumber

type

uniqueId

Index

Hierarchy

AcceptTransaction Class Reference

	Inherits from
	NSObject

	Declared in
	AcceptTransaction.h

Overview

@class AcceptTransaction

Complete Payment item info

Tasks

		  tipTaxRate

	property

		  guwid

	property

		  gatewaySignature

	property

		  cnpTransactionCertificate

	property

		  receiptRequested

	property

		  taxHidden

	property

		  currency

	property

		  deviceType

	property

		  gatewayLive

	property

		  processedAt

	property

		  cardHolderLastName

	property

		  lng

	property

		  additionalInfo

	property

		  serviceChargeHidden

	property

		  technicalMessage

	property

		  note

	property

		  cnpApplicationId

	property

		  emailReceipt

	property

		  txNumber

	property

		  gratuityType

	property

		  tip

	property

		  countryCode

	property

		  cardHolderFirstName

	property

		  state

	property

		  location

	property

		  refundable

	property

		  gatewayLogin

	property

		  cnpTvr

	property

		  type

	property

		  status

	property

		  bankCode

	property

		  tax

	property

		  cnpIssuerResponseCode

	property

		  cnpAuthorizationNumber

	property

		  cnpAuthorizationCode

	property

		  cnpMerchantId

	property

		  emvTransactionType

	property

		  expectsTC

	property

		  capturable

	property

		  reversible

	property

		  referenceId

	property

		  gatewayPassword

	property

		  lat

	property

		  merchantId

	property

		  cnpApplicationLabel

	property

		  items

	property

		  createdAt

	property

		  transactionType

	property

		  cardType

	property

		  amount

	property

		  cnpTsi

	property

		  uniqueId

	property

		  signature

	property

		  refunds

	property

		  reversals

	property

		  errorCode

	property

		  cardNumber

	property

		  serviceChargeAmount

	property

		  cnpTerminalId

	property

		  issuerScript

	property

Properties

additionalInfo

@property (nonatomic, strong) NSString *additionalInfo

Declared In

		AcceptTransaction.h

amount

@property (nonatomic) NSInteger amount

Declared In

		AcceptTransaction.h

bankCode

@property (nonatomic, strong) NSString *bankCode

Declared In

		AcceptTransaction.h

capturable

@property (nonatomic) BOOL capturable

Declared In

		AcceptTransaction.h

cardHolderFirstName

@property (nonatomic, strong) NSString *cardHolderFirstName

Declared In

		AcceptTransaction.h

cardHolderLastName

@property (nonatomic, strong) NSString *cardHolderLastName

Declared In

		AcceptTransaction.h

cardNumber

@property (nonatomic, strong) NSString *cardNumber

Declared In

		AcceptTransaction.h

cardType

@property (nonatomic, strong) NSString *cardType

Declared In

		AcceptTransaction.h

cnpApplicationId

@property (nonatomic, strong) NSString *cnpApplicationId

Declared In

		AcceptTransaction.h

cnpApplicationLabel

@property (nonatomic, strong) NSString *cnpApplicationLabel

Declared In

		AcceptTransaction.h

cnpAuthorizationCode

@property (nonatomic, strong) NSString *cnpAuthorizationCode

Declared In

		AcceptTransaction.h

cnpAuthorizationNumber

@property (nonatomic, strong) NSString *cnpAuthorizationNumber

Declared In

		AcceptTransaction.h

cnpIssuerResponseCode

@property (nonatomic, strong) NSString *cnpIssuerResponseCode

Declared In

		AcceptTransaction.h

cnpMerchantId

@property (nonatomic, strong) NSString *cnpMerchantId

Declared In

		AcceptTransaction.h

cnpTerminalId

@property (nonatomic, strong) NSString *cnpTerminalId

Declared In

		AcceptTransaction.h

cnpTransactionCertificate

@property (nonatomic, strong) NSString *cnpTransactionCertificate

Declared In

		AcceptTransaction.h

cnpTsi

@property (nonatomic, strong) NSString *cnpTsi

Declared In

		AcceptTransaction.h

cnpTvr

@property (nonatomic, strong) NSString *cnpTvr

Declared In

		AcceptTransaction.h

countryCode

@property (nonatomic) NSInteger countryCode

Declared In

		AcceptTransaction.h

createdAt

@property (nonatomic, strong) NSString *createdAt

Declared In

		AcceptTransaction.h

currency

@property (nonatomic, strong) NSString *currency

Declared In

		AcceptTransaction.h

deviceType

@property (nonatomic, strong) NSString *deviceType

Declared In

		AcceptTransaction.h

emailReceipt

@property (nonatomic) BOOL emailReceipt

Declared In

		AcceptTransaction.h

emvTransactionType

@property (nonatomic, strong) NSString *emvTransactionType

Declared In

		AcceptTransaction.h

errorCode

@property (nonatomic, strong) NSString *errorCode

Declared In

		AcceptTransaction.h

expectsTC

@property (nonatomic) BOOL expectsTC

Declared In

		AcceptTransaction.h

gatewayLive

@property (nonatomic) BOOL gatewayLive

Declared In

		AcceptTransaction.h

gatewayLogin

@property (nonatomic, strong) NSString *gatewayLogin

Declared In

		AcceptTransaction.h

gatewayPassword

@property (nonatomic, strong) NSString *gatewayPassword

Declared In

		AcceptTransaction.h

gatewaySignature

@property (nonatomic, strong) NSString *gatewaySignature

Declared In

		AcceptTransaction.h

gratuityType

@property (nonatomic, strong) NSString *gratuityType

Declared In

		AcceptTransaction.h

guwid

@property (nonatomic, strong) NSString *guwid

Declared In

		AcceptTransaction.h

issuerScript

@property (nonatomic, strong) NSString *issuerScript

Declared In

		AcceptTransaction.h

items

@property (nonatomic, strong) NSArray *items

Declared In

		AcceptTransaction.h

lat

@property (nonatomic, strong) NSString *lat

Declared In

		AcceptTransaction.h

lng

@property (nonatomic, strong) NSString *lng

Declared In

		AcceptTransaction.h

location

@property (nonatomic, strong) NSString *location

Declared In

		AcceptTransaction.h

merchantId

@property (nonatomic) NSInteger merchantId

Declared In

		AcceptTransaction.h

note

@property (nonatomic, strong) NSString *note

Declared In

		AcceptTransaction.h

processedAt

@property (nonatomic, strong) NSString *processedAt

Declared In

		AcceptTransaction.h

receiptRequested

@property (nonatomic) BOOL receiptRequested

Declared In

		AcceptTransaction.h

referenceId

@property (nonatomic, strong) NSString *referenceId

Declared In

		AcceptTransaction.h

refundable

@property (nonatomic) BOOL refundable

Declared In

		AcceptTransaction.h

refunds

@property (nonatomic, strong) NSArray *refunds

Declared In

		AcceptTransaction.h

reversals

@property (nonatomic, strong) NSArray *reversals

Declared In

		AcceptTransaction.h

reversible

@property (nonatomic) BOOL reversible

Declared In

		AcceptTransaction.h

serviceChargeAmount

@property (nonatomic) NSInteger serviceChargeAmount

Declared In

		AcceptTransaction.h

serviceChargeHidden

@property (nonatomic) BOOL serviceChargeHidden

Declared In

		AcceptTransaction.h

signature

@property (nonatomic, strong) AcceptTransactionSignature *signature

Declared In

		AcceptTransaction.h

state

@property (nonatomic, strong) NSString *state

Declared In

		AcceptTransaction.h

status

@property (nonatomic, strong) NSString *status

Declared In

		AcceptTransaction.h

tax

@property (nonatomic) NSInteger tax

Declared In

		AcceptTransaction.h

taxHidden

@property (nonatomic) BOOL taxHidden

Declared In

		AcceptTransaction.h

technicalMessage

@property (nonatomic, strong) NSString *technicalMessage

Declared In

		AcceptTransaction.h

tip

@property (nonatomic) NSInteger tip

Declared In

		AcceptTransaction.h

tipTaxRate

@property (nonatomic, strong) NSString *tipTaxRate

Declared In

		AcceptTransaction.h

transactionType

@property (nonatomic, strong) NSString *transactionType

Declared In

		AcceptTransaction.h

txNumber

@property (nonatomic) NSInteger txNumber

Declared In

		AcceptTransaction.h

type

@property (nonatomic, strong) NSString *type

Declared In

		AcceptTransaction.h

uniqueId

@property (nonatomic, strong) NSString *uniqueId

Declared In

		AcceptTransaction.h

Index

Hierarchy

© 2015 Wirecard. All rights reserved. (Last updated: 2015-07-28)

						Generated by appledoc 2.2 (build 963).


text:
package petablox.analyses.escape.metaback;

import petablox.analyses.alloc.DomH;
import petablox.project.analyses.metaback.dnf.DNFFactory;
import petablox.project.analyses.metaback.dnf.Domain;
import petablox.project.analyses.metaback.dnf.Variable;

public class EscDNFFactory implements DNFFactory {
	private final static EscDNFFactory singleton = new EscDNFFactory();
	private static DomH dom;

	public static void setDomH(DomH other) {
		dom = other;
	}

	private EscDNFFactory() { }

	public static EscDNFFactory getSingleton() {
		return singleton;
	}

	@Override
	public Domain genDomainFromStr(String str) {
		return Value.getValue(str);
	}

	@Override
	public Variable genVarFromStr(String str) {
		int idx = Integer.parseInt(str);
		return new EscHVariable(idx,dom);
	}
}


text:
package com.swfarm.biz.aliexpress.web;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.swfarm.biz.aliexpress.bo.AliExpressAccount;
import com.swfarm.biz.aliexpress.job.AdjustAliExpressItemsTask;
import com.swfarm.biz.aliexpress.srv.AliExpressQueryService;
import com.swfarm.biz.aliexpress.srv.AliExpressSaleService;
import com.swfarm.biz.aliexpress.srv.AliExpressService;
import com.swfarm.biz.chain.srv.ChainService;
import com.swfarm.biz.chain.web.ChainFrontHelper;

public class AdjustAliExpressItemsController extends AbstractController {

	private ChainService chainService;

	private AliExpressService aliExpressService;

	private AliExpressSaleService aliExpressSaleService;

	private AliExpressQueryService aliExpressQueryService;

	public void setChainService(ChainService chainService) {
		this.chainService = chainService;
	}

	public void setAliExpressService(AliExpressService aliExpressService) {
		this.aliExpressService = aliExpressService;
	}

	public void setAliExpressSaleService(
			AliExpressSaleService aliExpressSaleService) {
		this.aliExpressSaleService = aliExpressSaleService;
	}

	public void setAliExpressQueryService(
			AliExpressQueryService aliExpressQueryService) {
		this.aliExpressQueryService = aliExpressQueryService;
	}

	protected ModelAndView handleRequestInternal(HttpServletRequest req,
			HttpServletResponse res) throws Exception {
		ChainFrontHelper.refreshAliExpressItemsSaleQuantities();
		String accountNumber = req.getParameter("accountNumber");
		List aliExpressAccounts = null;
		if (StringUtils.isNotEmpty(accountNumber)) {
			aliExpressAccounts = new ArrayList();
			AliExpressAccount aliExpressAccount = this.aliExpressService
					.findAliExpressAccountByAccountNumber(accountNumber);
			aliExpressAccounts.add(aliExpressAccount);
		} else {
			aliExpressAccounts = this.aliExpressService
					.findAliExpressAccounts();
		}
		if (CollectionUtils.isNotEmpty(aliExpressAccounts)) {
			AdjustAliExpressItemsTask task = new AdjustAliExpressItemsTask();
			task.setChainService(chainService);
			task.setAliExpressService(aliExpressService);
			task.setAliExpressSaleService(aliExpressSaleService);
			task.setAliExpressQueryService(aliExpressQueryService);
			for (Iterator iter = aliExpressAccounts.iterator(); iter.hasNext();) {
				AliExpressAccount aliExpressAccount = (AliExpressAccount) iter
						.next();
				if (aliExpressAccount.getIsAutoAdjustPriceBySale() == true) {
					try {
						task.adjustAliExpressItems(aliExpressAccount
								.getAccountNumber());
					} catch (Exception e) {
						logger.warn(e);
					}
				}
			}
		}
		return new ModelAndView(
				"redirect:/aliexpress/search_aliexpressitems.shtml");
	}

}


text:
/*
 * cgeBrightnessAdjust.h
 *
 *  Created on: 2013-12-26
 *      Author: Wang Yang
 */

#ifndef _CGE_HEARTFILTER_H_
#define _CGE_HEARTFILTER_H_

#include "cgeGLFunctions.h"

namespace CGE
{
	class CGEHeartFilter : public CGEImageFilterInterface
	{
	public:

		void setIntensity(float value); // range: [-1, 1]

		bool init();

        void render2Texture(CGEImageHandlerInterface* handler, GLuint srcTexture, GLuint vertexBufferID);

	protected:
		static CGEConstString paramName;

    private:
        float m_intensity;
	};
}

#endif


text:
describe("handsontable.MergeCells", function () {
  var id = 'testContainer';

  beforeEach(function () {
    this.$container = $('

').appendTo('body');
  });

  afterEach(function () {
    if (this.$container) {
      destroy();
      this.$container.remove();
    }
  });

  describe("canMergeRange", function () {
    it("should return false if start and end cell is the same", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(10, 5)
      });
      var mergeCells = new Handsontable.MergeCells(hot);
      var coordsFrom = new WalkontableCellCoords(0, 1);
      var cellRange = new WalkontableCellRange(coordsFrom, coordsFrom, new WalkontableCellCoords(0, 1));
      var result = mergeCells.canMergeRange(cellRange);
      expect(result).toBe(false);
    });

    it("should return true for 2 consecutive cells in the same column", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(10, 5)
      });
      var mergeCells = new Handsontable.MergeCells(hot);
      var coordsFrom = new WalkontableCellCoords(0, 1);
      var cellRange = new WalkontableCellRange(coordsFrom, coordsFrom, new WalkontableCellCoords(1, 1));
      var result = mergeCells.canMergeRange(cellRange);
      expect(result).toBe(true);
    });

    it("should return true for 2 consecutive cells in the same row", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(10, 5)
      });
      var mergeCells = new Handsontable.MergeCells(hot);
      var coordsFrom = new WalkontableCellCoords(0, 1);
      var cellRange = new WalkontableCellRange(coordsFrom, coordsFrom, new WalkontableCellCoords(0, 2));
      var result = mergeCells.canMergeRange(cellRange);
      expect(result).toBe(true);
    });

    it("should return true for 4 neighboring cells", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(10, 5)
      });
      var mergeCells = new Handsontable.MergeCells(hot);
      var coordsFrom = new WalkontableCellCoords(0, 1);
      var cellRange = new WalkontableCellRange(coordsFrom, coordsFrom, new WalkontableCellCoords(1, 2));
      var result = mergeCells.canMergeRange(cellRange);
      expect(result).toBe(true);
    });
  });

  describe("mergeCells option", function () {
    it("should merge cell in startup", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(10, 5),
        mergeCells: [
          {row: 0, col: 0, rowspan: 2, colspan: 2}
        ]
      });
      var TD = hot.rootElement.querySelector('td');
      expect(TD.getAttribute('rowspan')).toBe('2');
      expect(TD.getAttribute('colspan')).toBe('2');
    });
  });

  describe("mergeCells copy", function () {
    it("should not copy text of cells that are merged into another cell", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(10, 5),
        mergeCells: [
          {row: 0, col: 0, rowspan: 2, colspan: 2}
        ]
      });
      expect(hot.getCopyableData(0, 0, 2, 2)).toBe("A1\t\tC1\n\t\tC2\nA3\tB3\tC3\n");
    });
  });

  describe("merged cells selection", function () {

    it("should select the whole range of cells which form a merged cell", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(4, 4),
        mergeCells: [
          {
            row: 0,
            col: 0,
            colspan: 4,
            rowspan: 1
          }
        ]
      });

      var $table = this.$container.find('table.htCore');
      var $td = $table.find('tr:eq(0) td:eq(0)');

      expect($td.attr('rowspan')).toEqual('1');
      expect($td.attr('colspan')).toEqual('4');

      expect(hot.getSelected()).toBeUndefined();

      hot.selectCell(0, 0);

      expect(hot.getSelected()).toEqual([0, 0, 0, 3]);

      deselectCell();

      hot.selectCell(0, 1);

      expect(hot.getSelected()).toEqual([0, 0, 0, 3]);
    });

    it("should always make a rectangular selection, when selecting merged and not merged cells", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(4, 4),
        mergeCells: [
          {
            row: 1,
            col: 1,
            colspan: 3,
            rowspan: 2
          }
        ]
      });

      var $table = this.$container.find('table.htCore');
      var $td = $table.find('tr:eq(1) td:eq(1)');

      expect($td.attr('rowspan')).toEqual('2');
      expect($td.attr('colspan')).toEqual('3');

      expect(hot.getSelected()).toBeUndefined();

      hot.selectCell(0, 0);

      expect(hot.getSelected()).toEqual([0, 0, 0, 0]);

      deselectCell();

      hot.selectCell(0, 0, 1, 1);

      expect(hot.getSelected()).not.toEqual([0, 0, 1, 1]);
      expect(hot.getSelected()).toEqual([0, 0, 2, 3]);

      deselectCell();

      hot.selectCell(0, 1, 1, 1);

      expect(hot.getSelected()).toEqual([0, 1, 2, 3]);

    });

    it("should not switch the selection start point when selecting from non-merged cells to merged cells", function() {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(10, 10),
        mergeCells: [
          {row: 1, col: 1, rowspan: 3, colspan: 3},
          {row: 3, col: 4, rowspan: 2, colspan: 2}
        ]
      });

      $(hot.getCell(6,6)).simulate('mousedown');

      expect(hot.getSelectedRange().from.col).toEqual(6);
      expect(hot.getSelectedRange().from.row).toEqual(6);

      $(hot.getCell(1,1)).simulate('mouseenter');

      expect(hot.getSelectedRange().from.col).toEqual(6);
      expect(hot.getSelectedRange().from.row).toEqual(6);

      $(hot.getCell(3,3)).simulate('mouseenter');

      expect(hot.getSelectedRange().from.col).toEqual(6);
      expect(hot.getSelectedRange().from.row).toEqual(6);

      $(hot.getCell(4,4)).simulate('mouseenter');

      expect(hot.getSelectedRange().from.col).toEqual(6);
      expect(hot.getSelectedRange().from.row).toEqual(6);

    });

    it("should select cells in the correct direction when changing selections around a merged range", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(10, 10),
        mergeCells: [
          {row: 4, col: 4, rowspan: 2, colspan: 2}
        ]
      });

      hot.selectCell(5,5,5,2);
      expect(hot.getSelectedRange().getDirection()).toEqual("SE-NW");

      hot.selectCell(4,4,2,5);
      expect(hot.getSelectedRange().getDirection()).toEqual("SW-NE");

      hot.selectCell(4,4,5,7);
      expect(hot.getSelectedRange().getDirection()).toEqual("NW-SE");

      hot.selectCell(4,5,7,5);
      expect(hot.getSelectedRange().getDirection()).toEqual("NE-SW");
    });

    it("should not add an area class to the selected cell if a single merged cell is selected", function() {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(6, 6),
        mergeCells: [
          {
            row: 1,
            col: 1,
            colspan: 3,
            rowspan: 2
          }
        ]
      });

      selectCell(1,1);
      expect(getCell(1,1).className.indexOf('area')).toEqual(-1);

      selectCell(1,1,4,4);
      expect(getCell(1,1).className.indexOf('area')).toNotEqual(-1);

      selectCell(1,1);
      expect(getCell(1,1).className.indexOf('area')).toEqual(-1);

      selectCell(0,0);
      expect(getCell(1,1).className.indexOf('area')).toEqual(-1);

    });

  });

  describe("modifyTransform", function () {

    it("should not transform arrow right when entering a merged cell", function () {
      var mergeCellsSettings = [
        {row: 1, col: 1, rowspan: 3, colspan: 3}
      ];
      var coords = new WalkontableCellCoords(1, 0);
      var currentSelection = new WalkontableCellRange(coords, coords, coords);
      var mergeCells = new Handsontable.MergeCells(mergeCellsSettings);
      var inDelta = new WalkontableCellCoords(0, 1);
      mergeCells.modifyTransform("modifyTransformStart", currentSelection, inDelta);
      expect(inDelta).toEqual(new WalkontableCellCoords(0, 1));
    });

    it("should transform arrow right when leaving a merged cell", function () {
      var mergeCellsSettings = [
        {row: 1, col: 1, rowspan: 3, colspan: 3}
      ];
      var coords = new WalkontableCellCoords(1, 1);
      var currentSelection = new WalkontableCellRange(coords, coords, coords);
      var mergeCells = new Handsontable.MergeCells(mergeCellsSettings);
      var inDelta = new WalkontableCellCoords(0, 1);
      mergeCells.modifyTransform("modifyTransformStart", currentSelection, inDelta);
      expect(inDelta).toEqual(new WalkontableCellCoords(0, 3));
    });

    it("should transform arrow right when leaving a merged cell (return to desired row)", function () {
      var mergeCellsSettings = [
        {row: 1, col: 1, rowspan: 3, colspan: 3}
      ];
      var mergeCells = new Handsontable.MergeCells(mergeCellsSettings);

      var coords = new WalkontableCellCoords(2, 0);
      var currentSelection = new WalkontableCellRange(coords, coords, coords);
      var inDelta = new WalkontableCellCoords(0, 1);
      mergeCells.modifyTransform("modifyTransformStart", currentSelection, inDelta);
      expect(inDelta).toEqual(new WalkontableCellCoords(-1, 1));

      var coords = new WalkontableCellCoords(1, 1);
      var currentSelection = new WalkontableCellRange(coords, coords, coords);
      var inDelta = new WalkontableCellCoords(0, 1);
      mergeCells.modifyTransform("modifyTransformStart", currentSelection, inDelta);
      expect(inDelta).toEqual(new WalkontableCellCoords(1, 3));
    });

    it("should transform arrow left when entering a merged cell", function () {
      var mergeCellsSettings = [
        {row: 1, col: 1, rowspan: 3, colspan: 3}
      ];
      var coords = new WalkontableCellCoords(1, 4);
      var currentSelection = new WalkontableCellRange(coords, coords, coords);
      var mergeCells = new Handsontable.MergeCells(mergeCellsSettings);
      var inDelta = new WalkontableCellCoords(0, -1);
      mergeCells.modifyTransform("modifyTransformStart", currentSelection, inDelta);
      expect(inDelta).toEqual(new WalkontableCellCoords(0, -3));
    });

    it("should not transform arrow left when leaving a merged cell", function () {
      var mergeCellsSettings = [
        {row: 1, col: 1, rowspan: 3, colspan: 3}
      ];
      var coords = new WalkontableCellCoords(1, 1);
      var currentSelection = new WalkontableCellRange(coords, coords, coords);
      var mergeCells = new Handsontable.MergeCells(mergeCellsSettings);
      var inDelta = new WalkontableCellCoords(0, -1);
      mergeCells.modifyTransform("modifyTransformStart", currentSelection, inDelta);
      expect(inDelta).toEqual(new WalkontableCellCoords(0, -1));
    });

    it("should transform arrow left when leaving a merged cell (return to desired row)", function () {
      var mergeCellsSettings = [
        {row: 1, col: 1, rowspan: 3, colspan: 3}
      ];
      var mergeCells = new Handsontable.MergeCells(mergeCellsSettings);

      var coords = new WalkontableCellCoords(2, 4);
      var currentSelection = new WalkontableCellRange(coords, coords, coords);
      var inDelta = new WalkontableCellCoords(0, -1);
      mergeCells.modifyTransform("modifyTransformStart", currentSelection, inDelta);
      expect(inDelta).toEqual(new WalkontableCellCoords(-1, -3));

      var coords = new WalkontableCellCoords(1, 1);
      var currentSelection = new WalkontableCellRange(coords, coords, coords);
      var inDelta = new WalkontableCellCoords(0, -1);
      mergeCells.modifyTransform("modifyTransformStart", currentSelection, inDelta);
      expect(inDelta).toEqual(new WalkontableCellCoords(1, -1));
    });

    it("should not transform arrow down when entering a merged cell", function () {
      var mergeCellsSettings = [
        {row: 1, col: 1, rowspan: 3, colspan: 3}
      ];
      var coords = new WalkontableCellCoords(0, 1);
      var currentSelection = new WalkontableCellRange(coords, coords, coords);
      var mergeCells = new Handsontable.MergeCells(mergeCellsSettings);
      var inDelta = new WalkontableCellCoords(0, -1);
      mergeCells.modifyTransform("modifyTransformStart", currentSelection, inDelta);
      expect(inDelta).toEqual(new WalkontableCellCoords(0, -1));
    });

    it("should transform arrow down when leaving a merged cell", function () {
      var mergeCellsSettings = [
        {row: 1, col: 1, rowspan: 3, colspan: 3}
      ];
      var coords = new WalkontableCellCoords(1, 1);
      var currentSelection = new WalkontableCellRange(coords, coords, coords);
      var mergeCells = new Handsontable.MergeCells(mergeCellsSettings);
      var inDelta = new WalkontableCellCoords(1, 0);
      mergeCells.modifyTransform("modifyTransformStart", currentSelection, inDelta);
      expect(inDelta).toEqual(new WalkontableCellCoords(3, 0));
    });

    it("should transform arrow up when entering a merged cell", function () {
      var mergeCellsSettings = [
        {row: 1, col: 1, rowspan: 3, colspan: 3}
      ];
      var coords = new WalkontableCellCoords(4, 1);
      var currentSelection = new WalkontableCellRange(coords, coords, coords);
      var mergeCells = new Handsontable.MergeCells(mergeCellsSettings);
      var inDelta = new WalkontableCellCoords(-1, 0);
      mergeCells.modifyTransform("modifyTransformStart", currentSelection, inDelta);
      expect(inDelta).toEqual(new WalkontableCellCoords(-3, 0));
    });

    it("should not transform arrow up when leaving a merged cell", function () {
      var mergeCellsSettings = [
        {row: 1, col: 1, rowspan: 3, colspan: 3}
      ];
      var coords = new WalkontableCellCoords(1, 1);
      var currentSelection = new WalkontableCellRange(coords, coords, coords);
      var mergeCells = new Handsontable.MergeCells(mergeCellsSettings);
      var inDelta = new WalkontableCellCoords(-1, 0);
      mergeCells.modifyTransform("modifyTransformStart", currentSelection, inDelta);
      expect(inDelta).toEqual(new WalkontableCellCoords(-1, 0));
    });

  });

  describe("merged cells scroll", function () {
    it("getCell should return merged cell parent", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(10, 5),
        mergeCells: [
          {row: 0, col: 0, rowspan: 2, colspan: 2}
        ],
        height: 100,
        width: 400
      });

      var mergedCellParent = hot.getCell(0, 0);
      var mergedCellHidden = hot.getCell(1, 1);

      expect(mergedCellHidden).toBe(mergedCellParent);
    });

    it("should scroll viewport to beginning of a merged cell when it's clicked", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(10, 5),
        mergeCells: [
          {row: 5, col: 0, rowspan: 2, colspan: 2}
        ],
        height: 100,
        width: 400
      });

      var mainHolder = hot.view.wt.wtTable.holder;

      mainHolder.scrollTop = 130;
      hot.render();

      expect(mainHolder.scrollTop).toBe(130);

      var TD = hot.getCell(5, 0);
      mouseDown(TD);
      mouseUp(TD);
      var mergedCellScrollTop = mainHolder.scrollTop;
      expect(mergedCellScrollTop).toBeLessThan(130);
      expect(mergedCellScrollTop).toBeGreaterThan(0);

      mainHolder.scrollTop = 0;
      hot.render();

      mainHolder.scrollTop = 130;
      hot.render();

      TD = hot.getCell(5, 2);
      mouseDown(TD);
      mouseUp(TD);
      var regularCellScrollTop = mainHolder.scrollTop;
      expect(mergedCellScrollTop).toBe(regularCellScrollTop);
    });

    it("should render whole merged cell even when most rows are not in the viewport - scrolled to top", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(40, 5),
        mergeCells: [
          {row: 1, col: 0, rowspan: 21, colspan: 2},
          {row: 21, col: 2, rowspan: 18, colspan: 2}
        ],
        height: 100,
        width: 400
      });

      expect(hot.countRenderedRows()).toBe(39);
    });

    it("should render whole merged cell even when most rows are not in the viewport - scrolled to bottom", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(40, 5),
        mergeCells: [
          {row: 1, col: 0, rowspan: 21, colspan: 2},
          {row: 21, col: 2, rowspan: 18, colspan: 2}
        ],
        height: 100,
        width: 400
      });

      var mainHolder = hot.view.wt.wtTable.holder;

      $(mainHolder).scrollTop(99999);
      hot.render();

      expect(hot.countRenderedRows()).toBe(39);
    });

    it("should render whole merged cell even when most columns are not in the viewport - scrolled to the left", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(5, 40),
        mergeCells: [
          {row: 0, col: 1, rowspan: 2, colspan: 21},
          {row: 2, col: 21, rowspan: 2, colspan: 18}
        ],
        height: 100,
        width: 400
      });

      expect(hot.countRenderedCols()).toBe(39);
    });

    it("should render whole merged cell even when most columns are not in the viewport - scrolled to the right", function () {
      var hot = handsontable({
        data: Handsontable.helper.createSpreadsheetObjectData(5, 40),
        mergeCells: [
          {row: 0, col: 1, rowspan: 2, colspan: 21},
          {row: 2, col: 21, rowspan: 2, colspan: 18}
        ],
        height: 100,
        width: 400
      });

      this.$container.scrollLeft(99999);
      hot.render();

      expect(hot.countRenderedCols()).toBe(39);
    });

  });
});


text:
package com.appcutt.demo.libs.imageloader.com.nostra13.universalimageloader.core.assist;

/**
 * Type of image scaling during decoding.
 *
 * @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
 * @since 1.5.0
 */
public enum ImageScaleType {
	/** Image won't be scaled */
	NONE,
	/**
	 * Image will be scaled down only if image size is greater than
	 * {@linkplain javax.microedition.khronos.opengles.GL10#GL_MAX_TEXTURE_SIZE maximum acceptable texture size}.
	 * Usually it's 2048x2048.

	 * If Bitmap is expected to display than it must not exceed this size (otherwise you'll get the exception
	 * "OpenGLRenderer: Bitmap too large to be uploaded into a texture".

	 * Image will be subsampled in an integer number of times (1, 2, 3, ...) to maximum texture size of device.
	 */
	NONE_SAFE,
	/**
	 * Image will be reduces 2-fold until next reduce step make image smaller target size.

	 * It's fast type and it's preferable for usage in lists/grids/galleries (and other
	 * {@linkplain android.widget.AdapterView adapter-views}) .

	 * Relates to {@link android.graphics.BitmapFactory.Options#inSampleSize}

	 * Note: If original image size is smaller than target size then original image won't be scaled.
	 */
	IN_SAMPLE_POWER_OF_2,
	/**
	 * Image will be subsampled in an integer number of times (1, 2, 3, ...). Use it if memory economy is quite
	 * important.

	 * Relates to {@link android.graphics.BitmapFactory.Options#inSampleSize}

	 * Note: If original image size is smaller than target size then original image won't be scaled.
	 */
	IN_SAMPLE_INT,
	/**
	 * Image will scaled-down exactly to target size (scaled width or height or both will be equal to target size;
	 * depends on {@linkplain android.widget.ImageView.ScaleType ImageView's scale type}). Use it if memory economy is
	 * critically important.

	 * Note: If original image size is smaller than target size then original image won't be scaled.

	 *

	 * NOTE: For creating result Bitmap (of exact size) additional Bitmap will be created with
	 * {@link android.graphics.Bitmap#createBitmap(android.graphics.Bitmap, int, int, int, int, android.graphics.Matrix, boolean)
	 * Bitmap.createBitmap(...)}.

	 * Cons: Saves memory by keeping smaller Bitmap in memory cache (comparing with IN_SAMPLE... scale types)

	 * Pros: Requires more memory in one time for creation of result Bitmap.
	 */
	EXACTLY,
	/**
	 * Image will scaled exactly to target size (scaled width or height or both will be equal to target size; depends on
	 * {@linkplain android.widget.ImageView.ScaleType ImageView's scale type}). Use it if memory economy is critically
	 * important.

	 * Note: If original image size is smaller than target size then original image will be stretched to
	 * target size.

	 *

	 * NOTE: For creating result Bitmap (of exact size) additional Bitmap will be created with
	 * {@link android.graphics.Bitmap#createBitmap(android.graphics.Bitmap, int, int, int, int, android.graphics.Matrix, boolean)
	 * Bitmap.createBitmap(...)}.

	 * Cons: Saves memory by keeping smaller Bitmap in memory cache (comparing with IN_SAMPLE... scale types)

	 * Pros: Requires more memory in one time for creation of result Bitmap.
	 */
	EXACTLY_STRETCHED
}