<commit_before>package com.cmput301f16t11.a2b;

import android.app.Activity;
import android.util.Log;

import com.google.android.gms.maps.model.LatLng;
import com.google.gson.Gson;

import org.apache.commons.lang3.ObjectUtils;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;

/**
 * Controllers user and user functions
 * static so it can be shared by all activities
 */
public class UserController {
    private static User user = null;
    private static Mode mode;


    private static String USRFILE = "user.sav";

    public UserController(User u) {
        user = u;
    }


//    static public boolean auth(String username){
//        // no idea what this is... - joey
//        // is this to statically check auth?
//        return true;
//    }



    static public void setUser(User newUser) {
        user = newUser;
    }

    static public void setMode(Mode newMode) {
        mode = newMode;
    }

    static public Mode checkMode() {
        mode = Mode.RIDER;
        return mode;
    }

    static public User getUser() {
        if(user != null){
            return user;
        }else{ // should always be set but for dev purposes return an existing object
            // TO DO: depricate this before production
            ElasticsearchUserController.CheckUserTask checkUserTask = new ElasticsearchUserController.CheckUserTask();
            try{
                user = checkUserTask.execute("<NAME>").get();// force syncronous
            }catch (Exception e){
                user = new User();
            }

            return user;
        }
    }

    // push user changes to the data base
    static public void updateUserInDb(){
        ElasticsearchUserController.UpdateUserInfoTask updateUserInfoTask = new ElasticsearchUserController.UpdateUserInfoTask();
        updateUserInfoTask.execute(user);
    }


    // time to depreciate this???
    static public User loadUser(String username){
        return new User();
    }

   static public String getNewUserName() {
        return "Daniel";
    }
   static public String getNewPass() {
        return "<PASSWORD>";
    }<commit_msg>Added UserController setters<commit_after>package com.cmput301f16t11.a2b;

import android.app.Activity;
import android.util.Log;

import com.google.android.gms.maps.model.LatLng;
import com.google.gson.Gson;

import org.apache.commons.lang3.ObjectUtils;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Collection;

/**
 * Controllers user and user functions
 * static so it can be shared by all activities
 */
public class UserController {
    private static User user = null;
    private static Mode mode;


    private static String USRFILE = "user.sav";

    public UserController(User u) {
        user = u;
    }


//    static public boolean auth(String username){
//        // no idea what this is... - joey
//        // is this to statically check auth?
//        return true;
//    }



    static public void setUser(User newUser) {
        user = newUser;
    }

    static public void setMode(Mode newMode) {
        mode = newMode;
    }

    static public Mode checkMode() {
        mode = Mode.RIDER;
        return mode;
    }

    static public User getUser() {
        if(user != null){
            return user;
        }else{ // should always be set but for dev purposes return an existing object
            // TO DO: depricate this before production
            ElasticsearchUserController.CheckUserTask checkUserTask = new ElasticsearchUserController.CheckUserTask();
            try{
                user = checkUserTask.execute("<NAME>").get();// force syncronous
            }catch (Exception e){
                user = new User();
            }

            return user;
        }
    }

    // push user changes to the data base
    static public void updateUserInDb(){
        ElasticsearchUserController.UpdateUserInfoTask updateUserInfoTask = new ElasticsearchUserController.UpdateUserInfoTask();
        updateUserInfoTask.execute(user);
    }

    public static void setClosedRequestsAsRider(Collection<UserRequest> requests) {
        user.setClosedRequestsAsRider(requests);
    }
    public static void setClosedRequestsAsDriver(Collection<UserRequest> requests) {
        user.setClosedRequestsAsDriver(requests);
    }
    public static void setActiveRequestsAsRider(Collection<UserRequest> requests) {
        user.setActiveRequestsAsRider(requests);

    }
    public static void setActiveRequestAsDriver(Collection<UserRequest> requests) {
        user.setActiveRequestsAsDriver(requests);
    }

    // time to depreciate this???
    static public User loadUser(String username){
        return new User();
    }

   static public String getNewUserName() {
        return "Daniel";
    }
   static public String getNewPass() {
        return "<PASSWORD>";
    }
{'fraction_non_alphanumeric': 0.08866103739445115, 'fraction_numerical': 0.0036188178528347406, 'mean_word_length': 2.513418079096045, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2274092', 'n_tokens_mistral': 1370, 'n_tokens_neox': 1328, 'n_words': 390}