1 package simpledb.file;
2
3
4
5
6
7
8
9
10 public class Block {
11 private String filename;
12 private int blknum;
13
14
15
16
17
18
19
20 public Block(String filename, int blknum) {
21 this.filename = filename;
22 this.blknum = blknum;
23 }
24
25
26
27
28
29 public String fileName() {
30 return filename;
31 }
32
33
34
35
36
37 public int number() {
38 return blknum;
39 }
40
41 public boolean equals(Object obj) {
42 Block blk = (Block) obj;
43 return filename.equals(blk.filename) && blknum == blk.blknum;
44 }
45
46 public String toString() {
47 return "[file " + filename + ", block " + blknum + "]";
48 }
49
50 public int hashCode() {
51 return toString().hashCode();
52 }
53 }