<commit_before>package plus1s.app.model;

import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Ivorycandy on 6/20/17.
 * Service Provider
 * provides functions of accessing Firebase
 */

public class Database {
    private Account user;
    private FirebaseDatabase database = FirebaseDatabase.getInstance();

    public void upLoadRequest() {
        Account user_1 = UserDetails.getCurrentUser();
        Account user_2 = UserDetails.getRegisterUser();
        if (user_1 != null) {
            DatabaseReference myRef = database.getReference(user_1.getUsername());
            myRef.setValue(user_1);
        } else if (user_2 != null) {
            DatabaseReference myRef = database.getReference(user_2.getUsername());
            myRef.setValue(user_2);
        }
    }

    public Account downloadRequest(final String username) {
        DatabaseReference myRef = database.getReference(username);
        myRef.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                if (dataSnapshot.hasChild(username)) {
                    user = dataSnapshot.getValue(Account.class);
                } else {
                    user = null;
                }
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {
            }
        });
        return user;
    }


}<commit_msg>updating<commit_after>package plus1s.app.model;

import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Ivorycandy on 6/20/17.
 * Service Provider
 * provides functions of accessing Firebase
 */

public class Database {
    private Account user;
    private FirebaseDatabase database = FirebaseDatabase.getInstance();

    public void upLoadRequest() {
        Account user_1 = UserDetails.getCurrentUser();
        Account user_2 = UserDetails.getRegisterUser();
        if (user_1 != null) {
            DatabaseReference myRef = database.getReference(user_1.getUsername());
            myRef.setValue(user_1);
        } else if (user_2 != null) {
            DatabaseReference myRef = database.getReference(user_2.getUsername());
            myRef.setValue(user_2);
        }
    }

    public Account downloadRequest(final String username) {
        DatabaseReference myRef = database.getReference(username);
        myRef.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                user = dataSnapshot.getValue(User.class);
//                if (dataSnapshot.hasChild(username)) {
//                    user = dataSnapshot.getValue(Account.class);
//                } else {
//                    user = null;
//                }
            }
            @Override
            public void onCancelled(DatabaseError databaseError) {
            }
        });
        return user;
    }


}
{'fraction_non_alphanumeric': 0.09164265129682997, 'fraction_numerical': 0.008069164265129682, 'mean_word_length': 2.453731343283582, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6197145', 'n_tokens_mistral': 902, 'n_tokens_neox': 880, 'n_words': 184}