dbms.buffer.IDEntry

来源:互联网 发布:黑客攻防编程解析pdf 编辑:程序博客网 时间:2024/06/10 15:14

package buffer;

class IDEntry {
 private Integer fileID;
 private int blockID;
 
 IDEntry (Integer fileID, int blockID) {
  this.fileID = fileID;
  this.blockID = blockID;
 }

 int getBlockID() {
  return blockID;
 }
 
 Integer getFileID() {
  return fileID;
 }
 
    public int hashCode() {
        int result = 17;
        result = 37*result + fileID.hashCode();
        result = 37*result + blockID;
        return result;
    }
 
    public boolean equals(Object obj) {
        if (obj instanceof IDEntry) {
            IDEntry id = (IDEntry) obj;
            return id.fileID.equals(fileID) && id.blockID == blockID;
        }
        return false;
    }
}

原创粉丝点击