<commit_before>package adullact.publicrowdfunding.model.local.ressource;

import java.util.ArrayList;
import java.util.Map;

import rx.Observable;
import adullact.publicrowdfunding.model.local.cache.CacheSet;
import adullact.publicrowdfunding.model.local.callback.HoldAllToDo;
import adullact.publicrowdfunding.model.local.callback.HoldToDo;
import adullact.publicrowdfunding.model.local.callback.WhatToDo;
import adullact.publicrowdfunding.model.server.entities.DetailedServerUser;
import adullact.publicrowdfunding.model.server.entities.RowAffected;
import adullact.publicrowdfunding.model.server.entities.ServerBookmark;
import adullact.publicrowdfunding.model.server.entities.ServerFunding;
import adullact.publicrowdfunding.model.server.entities.ServerProject;
import adullact.publicrowdfunding.model.server.entities.ServerUser;
import adullact.publicrowdfunding.model.server.entities.Service;
import adullact.publicrowdfunding.model.server.entities.SimpleServerResponse;
import adullact.publicrowdfunding.model.server.event.CreateEvent;
import adullact.publicrowdfunding.model.server.event.DeleteEvent;

/**
 * @author Ferrand and Nelaupe
 */
public class User extends Resource<User, ServerUser, DetailedServerUser> {
    private String m_pseudo;
    private String m_name;
    private String m_firstName;
    private String m_city;
    private String m_gender;
 //   private String m_email;
    private CacheSet<Project> m_proposedProjects;
    private CacheSet<Bookmark> m_bookmarks;
    private CacheSet<Funding> m_funding;

    /* ----- Resource ----- */
    @Override
    public String getResourceId() {
        return m_pseudo;
    }

    @Override
    public void setResourceId(String id) {
        this.m_pseudo = id;
    }

    @Override
    public ServerUser toServerResource() {
        ServerUser serverUser = new ServerUser();
        serverUser.pseudo = getResourceId();
        serverUser.name = this.m_name;
        serverUser.firstName = this.m_firstName;
        serverUser.city = this.m_city;
        serverUser.sexe = this.m_gender;

        return serverUser;
    }

    @Override
    public User makeCopyFromServer(ServerUser serverUser) {
        User user = new User();
        if(user.m_pseudo == null || user.m_name == null || user.m_firstName == null) {
            changed();
        }
        else {
            if((!(user.m_pseudo.equals(serverUser.pseudo)) || !(user.m_name.equals(serverUser.name)) || !user.m_firstName.equals(serverUser.firstName))) {
                changed();
            }
        }

        user.m_pseudo = serverUser.pseudo;
        user.m_name = serverUser.name;
        user.m_firstName = serverUser.firstName;
        user.m_city = serverUser.city;
        user.m_gender = serverUser.sexe;
        user.m_proposedProjects = new CacheSet<Project>();
        user.m_bookmarks = new CacheSet<Bookmark>();
        user.m_funding = new CacheSet<Funding>();

        return user;
    }

    @Override
    public User syncFromServer(DetailedServerUser detailedServerUser) {
        if(m_pseudo == null || m_name == null || m_firstName == null) {
            changed();
        }
        else {
            if((!(m_pseudo.equals(detailedServerUser.pseudo)) || !(m_name.equals(detailedServerUser.name)) || !m_firstName.equals(detailedServerUser.firstName))) {
                changed();
            }
        }

        this.m_pseudo = detailedServerUser.pseudo;
        this.m_name = detailedServerUser.name;
        this.m_firstName = detailedServerUser.firstName;
        this.m_city = detailedServerUser.city;
        //this.m_email = detailedServerUser.mail;
        this.m_gender = detailedServerUser.sexe;

        this.m_proposedProjects = new CacheSet<Project>();

        for(final ServerProject serverProject : detailedServerUser.proposedProjects) {
            m_proposedProjects.add(new Project().makeCopyFromServer(serverProject).getCache());
        }

        this.m_bookmarks = new CacheSet<Bookmark>();

        for(final ServerBookmark serverBookmark : detailedServerUser.bookmarkedProjects) {
            m_bookmarks.add(new Bookmark().makeCopyFromServer(serverBookmark).getCache());
        }
        
        this.m_funding = new CacheSet<Funding>();

        for(final ServerFunding serverFunding : detailedServerUser.fundedProjects) {
            //m_funding.add(new Funding().makeCopyFromServer(serverFunding).getCache(Integer.toString(serverFunding.id)));
        }
        return this;
    }

    /* ------ Method ------ */
    @Override<commit_msg>fix user<commit_after>package adullact.publicrowdfunding.model.local.ressource;

import java.util.ArrayList;
import java.util.Map;

import rx.Observable;
import adullact.publicrowdfunding.model.local.cache.CacheSet;
import adullact.publicrowdfunding.model.local.callback.HoldAllToDo;
import adullact.publicrowdfunding.model.local.callback.HoldToDo;
import adullact.publicrowdfunding.model.local.callback.WhatToDo;
import adullact.publicrowdfunding.model.server.entities.DetailedServerUser;
import adullact.publicrowdfunding.model.server.entities.RowAffected;
import adullact.publicrowdfunding.model.server.entities.ServerBookmark;
import adullact.publicrowdfunding.model.server.entities.ServerFunding;
import adullact.publicrowdfunding.model.server.entities.ServerProject;
import adullact.publicrowdfunding.model.server.entities.ServerUser;
import adullact.publicrowdfunding.model.server.entities.Service;
import adullact.publicrowdfunding.model.server.entities.SimpleServerResponse;
import adullact.publicrowdfunding.model.server.event.CreateEvent;
import adullact.publicrowdfunding.model.server.event.DeleteEvent;

/**
 * @author Ferrand and Nelaupe
 */
public class User extends Resource<User, ServerUser, DetailedServerUser> {
    private String m_pseudo;
    private String m_name;
    private String m_firstName;
    private String m_city;
    private String m_gender;
 //   private String m_email;
    private CacheSet<Project> m_proposedProjects;
    private CacheSet<Bookmark> m_bookmarks;
    private CacheSet<Funding> m_funding;

    /* ----- Resource ----- */
    @Override
    public String getResourceId() {
        return m_pseudo;
    }

    @Override
    public void setResourceId(String id) {
        this.m_pseudo = id;
    }

    @Override
    public ServerUser toServerResource() {
        ServerUser serverUser = new ServerUser();
        serverUser.pseudo = getResourceId();
        serverUser.name = this.m_name;
        serverUser.firstName = this.m_firstName;
        serverUser.city = this.m_city;
        serverUser.sexe = this.m_gender;

        return serverUser;
    }

    @Override
    public User makeCopyFromServer(ServerUser serverUser) {
        User user = new User();
        if(user.m_pseudo == null || user.m_name == null || user.m_firstName == null) {
            changed();
        }
        else {
            if((!(user.m_pseudo.equals(serverUser.pseudo)) || !(user.m_name.equals(serverUser.name)) || !user.m_firstName.equals(serverUser.firstName))) {
                changed();
            }
        }

        user.m_pseudo = serverUser.pseudo;
        user.m_name = serverUser.name;
        user.m_firstName = serverUser.firstName;
        user.m_city = serverUser.city;
        user.m_gender = serverUser.sexe;
        user.m_proposedProjects = new CacheSet<Project>();
        user.m_bookmarks = new CacheSet<Bookmark>();
        user.m_funding = new CacheSet<Funding>();

        return user;
    }

    @Override
    public User syncFromServer(DetailedServerUser detailedServerUser) {
        if(m_pseudo == null || m_name == null || m_firstName == null) {
            changed();
        }
        else {
            if((!(m_pseudo.equals(detailedServerUser.pseudo)) || !(m_name.equals(detailedServerUser.name)) || !m_firstName.equals(detailedServerUser.firstName))) {
                changed();
            }
        }

        this.m_pseudo = detailedServerUser.pseudo;
        this.m_name = detailedServerUser.name;
        this.m_firstName = detailedServerUser.firstName;
        this.m_city = detailedServerUser.city;
        //this.m_email = detailedServerUser.mail;
        this.m_gender = detailedServerUser.sexe;

        this.m_proposedProjects = new CacheSet<Project>();

        for(final ServerProject serverProject : detailedServerUser.proposedProjects) {
            m_proposedProjects.add(new Project().makeCopyFromServer(serverProject).getCache());
        }

        this.m_bookmarks = new CacheSet<Bookmark>();

        for(final ServerBookmark serverBookmark : detailedServerUser.bookmarkedProjects) {
            m_bookmarks.add(new Bookmark().makeCopyFromServer(serverBookmark).getCache());
        }
        
        this.m_funding = new CacheSet<Funding>();

        for(final ServerFunding serverFunding : detailedServerUser.fundedProjects) {
            m_funding.add(new Funding().makeCopyFromServer(serverFunding).getCache(Integer.toString(serverFunding.id)));
        }
        return this;
    }

    /* ------ Method ------ */
    @Override
{'fraction_non_alphanumeric': 0.10515851099083177, 'fraction_numerical': 0.0, 'mean_word_length': 3.1342465753424658, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '6723620', 'n_tokens_mistral': 2745, 'n_tokens_neox': 2682, 'n_words': 420}