<commit_before>package com.example.ismailamrani.comptable.Models;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Date;

/**
 * Created by <NAME> on 27/04/2016.
 * <p>
 * Represents a user in possession of a user name & a password.
 */
public class User {
    private int id;
    private String firstname;
    private String lastname;
    private String type;
    private Date creationDate;
    private Date expirationDate;
    private String username;
    private String password;
    private int companyID;

    public static class Builder {
        private int id;
        private String firstname;
        private String lastname;
        private String type;
        private Date creationDate;
        private Date expirationDate;
        private String username;
        private String password;
        private int companyID;

        public User createUser() {
            return new User(this);
        }

        public Builder id(int id) {
            this.id = id;
            return this;
        }

        public Builder firstname(String firstname) {
            this.firstname = firstname;
            return this;
        }

        public Builder lastname(String lastname) {
            this.lastname = lastname;
            return this;
        }

        public Builder type(String type) {
            this.type = type;
            return this;
        }

        public Builder creationDate(Date creationDate) {
            this.creationDate = creationDate;
            return this;
        }

        public Builder expirationDate(Date expirationDate) {
            this.expirationDate = expirationDate;
            return this;
        }

        public Builder username(String username) {
            this.username = username;
            return this;
        }

        public Builder password(String password) {
            this.password = password;
            return this;
        }

        public Builder companyID(int companyID) {
            this.companyID = companyID;
            return this;
        }
    }

    public User(Builder builder) {
        this.id = builder.id;
        this.firstname = builder.firstname;
        this.lastname = builder.lastname;
        this.type = builder.type;
        this.creationDate = builder.creationDate;
        this.expirationDate = builder.expirationDate;
        this.username = builder.username;
        this.password = <PASSWORD>;
        this.companyID = builder.companyID;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }<commit_msg>Add an overloaded constructor to the 'User' class that builds a new instance of a JSONObject.<commit_after>package com.example.ismailamrani.comptable.Models;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Date;

/**
 * Created by <NAME> on 27/04/2016.
 * <p>
 * Represents a user in possession of a user name & a password.
 */
public class User {
    private int id;
    private String firstname;
    private String lastname;
    private String type;
    private Date creationDate;
    private Date expirationDate;
    private String username;
    private String password;
    private int companyID;

    public static class Builder {
        private int id;
        private String firstname;
        private String lastname;
        private String type;
        private Date creationDate;
        private Date expirationDate;
        private String username;
        private String password;
        private int companyID;

        public User createUser() {
            return new User(this);
        }

        public Builder id(int id) {
            this.id = id;
            return this;
        }

        public Builder firstname(String firstname) {
            this.firstname = firstname;
            return this;
        }

        public Builder lastname(String lastname) {
            this.lastname = lastname;
            return this;
        }

        public Builder type(String type) {
            this.type = type;
            return this;
        }

        public Builder creationDate(Date creationDate) {
            this.creationDate = creationDate;
            return this;
        }

        public Builder expirationDate(Date expirationDate) {
            this.expirationDate = expirationDate;
            return this;
        }

        public Builder username(String username) {
            this.username = username;
            return this;
        }

        public Builder password(String password) {
            this.password = password;
            return this;
        }

        public Builder companyID(int companyID) {
            this.companyID = companyID;
            return this;
        }
    }

    public User(Builder builder) {
        this.id = builder.id;
        this.firstname = builder.firstname;
        this.lastname = builder.lastname;
        this.type = builder.type;
        this.creationDate = builder.creationDate;
        this.expirationDate = builder.expirationDate;
        this.username = builder.username;
        this.password = <PASSWORD>;
        this.companyID = builder.companyID;
    }

    /**
     * Overloaded constructor.
     * Builds a new instance whose informations are extracted from the passed-in
     * JSON object.
     * @param user parameter
     */
    public User(JSONObject user) {
        try {
            this.id = user.getInt("iduser");
            this.firstname = user.getString("prenom");
            this.lastname = user.getString("nom");
            this.type = user.getString("type");
            this.username = user.getString("Username");
            this.password = user.getString("Password");
            this.companyID = user.getInt("SocieteID");

        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }
{'fraction_non_alphanumeric': 0.07674013001426985, 'fraction_numerical': 0.0025368638021246235, 'mean_word_length': 1.8478555304740407, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4154764', 'n_tokens_mistral': 1648, 'n_tokens_neox': 1585, 'n_words': 469}