aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/gnunet/core/RequestIdentification.java
blob: 4f6a734c4bb3c5a47f9dff5a713fad8a2b255c99 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package org.gnunet.core;

import org.gnunet.peerinfo.PeerInfo;
import org.gnunet.util.PeerIdentity;


final class RequestIdentification {
    public final int requestIdentifier;
    public final PeerIdentity peerIdentity;

    public RequestIdentification(int requestIdentifier, PeerIdentity peerIdentity) {
        this.requestIdentifier = requestIdentifier;
        this.peerIdentity = peerIdentity;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        RequestIdentification that = (RequestIdentification) o;

        if (requestIdentifier != that.requestIdentifier) return false;
        if (!peerIdentity.equals(that.peerIdentity)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = requestIdentifier;
        result = 31 * result + peerIdentity.hashCode();
        return result;
    }
}