Project

General

Profile

Statistics
| Revision:

root / project / src / main / java / file / FileChunkID.java @ 1

History | View | Annotate | Download (1.09 KB)

1 1 up20120064
package main.java.file;
2
3
4
import java.io.Serializable;
5
6
public class FileChunkID implements Serializable {
7
8
    private static final long serialVersionUID = 1L;
9
10
11
    private String fileID;
12
    private int chunkNumber;
13
14
    public FileChunkID(String fileID, int chunkNumber) {
15
        this.fileID = fileID;
16
        this.chunkNumber = chunkNumber;
17
    }
18
19
    public String getFileID() {
20
        return fileID;
21
    }
22
23
    public int getChunkNumber() {
24
        return chunkNumber;
25
    }
26
27
    @Override
28
    public int hashCode() {
29
        int result = 17;
30
        result = 31 * result + fileID.hashCode();
31
        result = 31 * result + chunkNumber;
32
33
        return result;
34
    }
35
36
    @Override
37
    public boolean equals(Object obj) {
38
39
        if (this == obj)
40
            return true;
41
42
        if (obj == null)
43
            return false;
44
45
46
        FileChunkID other = (FileChunkID) obj;
47
48
        if (this.chunkNumber != other.chunkNumber)
49
            return false;
50
51
        return this.fileID.equals(other.fileID);
52
    }
53
54
    @Override
55
    public String toString() {
56
        return fileID + "-" + chunkNumber;
57
    }
58
}