<commit_before>package org.lantern.state;

import java.io.Serializable;

import org.apache.commons.lang3.StringUtils;


public class Friend implements Serializable {
    private static final long serialVersionUID = 6669786580088595294L;

    private String email;

    private String name = "";

    public enum Status {
        friend,
        rejected,
        requested //they have requested that we become a friend
    }

    private Status status;

    /**
     * The last time the status was updated by a user action or request, in
     * milliseconds since epoch
     */
    private long lastUpdated;

    /**
     * The next time, in milliseconds since epoch, that we will ask the user
     * about this friend, assuming status=requested.
     */
    private long nextQuery;

    /**
     * Whether or not an XMPP subscription request from this user is pending.
     */
    private boolean pendingSubscriptionRequest;

    public Friend() {
        lastUpdated = System.currentTimeMillis();
    }

    public Friend(String email) {
        lastUpdated = System.currentTimeMillis();
        this.setEmail(email);
    }

    public Friend(String email, Status status, String name, long nextQuery, long lastUpdated) {
        this.email = email;
        this.status = status;
        this.name = name;
        this.nextQuery = nextQuery;
        this.lastUpdated = lastUpdated;
    }

    public void update(Friend other) {
        this.status = other.status;
        this.name = other.name;
        this.nextQuery = other.nextQuery;
        this.lastUpdated = other.lastUpdated;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        String oldName = this.name;
        this.name = name;
        if (!StringUtils.equals(name, oldName)) {
            updated();
        }
    }

    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        Status oldStatus = this.status;
        this.status = status;
        if (status != oldStatus) {
            updated();
        }
    }

    private void updated() {
        this.setLastUpdated(System.currentTimeMillis());
    }

    public long getLastUpdated() {
        return lastUpdated;
    }

    public void setLastUpdated(long lastUpdated) {
        this.lastUpdated = lastUpdated;
    }

    public long getNextQuery() {
        return nextQuery;
    }

    public void setNextQuery(long nextQuery) {
        this.nextQuery = nextQuery;
    }

    public void setPendingSubscriptionRequest(boolean pending) {
        pendingSubscriptionRequest = pending;
        if (status == null) {
            status = Status.requested;
        }
    }

    public boolean isPendingSubscriptionRequest() {
        return pendingSubscriptionRequest;
    }

    public boolean shouldNotifyAgain() {
        if (status == null || status == Status.requested) {
            long now = System.currentTimeMillis();
            return nextQuery < now;
        }
        return false;
    }

    @Override
    public String toString() {
        return "Friend(" + email + ")";
    }
}<commit_msg>use pending as third status<commit_after>package org.lantern.state;

import java.io.Serializable;

import org.apache.commons.lang3.StringUtils;


public class Friend implements Serializable {
    private static final long serialVersionUID = 6669786580088595294L;

    private String email;

    private String name = "";

    public enum Status {
        friend,
        rejected,
        pending //everything else
    }

    private Status status = Status.pending;

    /**
     * The last time the status was updated by a user action or request, in
     * milliseconds since epoch
     */
    private long lastUpdated;

    /**
     * The next time, in milliseconds since epoch, that we will ask the user
     * about this friend, assuming status=requested.
     */
    private long nextQuery;

    /**
     * Whether or not an XMPP subscription request from this user is pending.
     */
    private boolean pendingSubscriptionRequest;

    public Friend() {
        lastUpdated = System.currentTimeMillis();
    }

    public Friend(String email) {
        lastUpdated = System.currentTimeMillis();
        this.setEmail(email);
    }

    public Friend(String email, Status status, String name, long nextQuery, long lastUpdated) {
        this.email = email;
        this.status = status;
        this.name = name;
        this.nextQuery = nextQuery;
        this.lastUpdated = lastUpdated;
    }

    public void update(Friend other) {
        this.status = other.status;
        this.name = other.name;
        this.nextQuery = other.nextQuery;
        this.lastUpdated = other.lastUpdated;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        String oldName = this.name;
        this.name = name;
        if (!StringUtils.equals(name, oldName)) {
            updated();
        }
    }

    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        Status oldStatus = this.status;
        this.status = status;
        if (status != oldStatus) {
            updated();
        }
    }

    private void updated() {
        this.setLastUpdated(System.currentTimeMillis());
    }

    public long getLastUpdated() {
        return lastUpdated;
    }

    public void setLastUpdated(long lastUpdated) {
        this.lastUpdated = lastUpdated;
    }

    public long getNextQuery() {
        return nextQuery;
    }

    public void setNextQuery(long nextQuery) {
        this.nextQuery = nextQuery;
    }

    public void setPendingSubscriptionRequest(boolean pending) {
        pendingSubscriptionRequest = pending;
    }

    public boolean isPendingSubscriptionRequest() {
        return pendingSubscriptionRequest;
    }

    public boolean shouldNotifyAgain() {
        if (status == Status.pending) {
            long now = System.currentTimeMillis();
            return nextQuery < now;
        }
        return false;
    }

    @Override
    public String toString() {
        return "Friend(" + email + ")";
    }
}
{'fraction_non_alphanumeric': 0.08511627906976744, 'fraction_numerical': 0.006201550387596899, 'mean_word_length': 2.146829268292683, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '814271', 'n_tokens_mistral': 1746, 'n_tokens_neox': 1686, 'n_words': 494}