strangedb/src/main/java/org/warp/jcwdb/IndexDetails.java

63 lines
1.3 KiB
Java

package org.warp.jcwdb;
public class IndexDetails {
/**
* The bitmask is used to determine if an index has been deleted
*/
public static final int OFFSET_BYTES = Long.BYTES;
public static final int DATA_SIZE_BYTES = Integer.BYTES;
public static final int TOTAL_BYTES = OFFSET_BYTES + DATA_SIZE_BYTES;
private final long offset;
private final int size;
public IndexDetails(long offset, int size) {
this.offset = offset;
this.size = size;
}
public IndexDetails(IndexDetails indexDetails) {
this.offset = indexDetails.offset;
this.size = indexDetails.size;
}
public long getOffset() {
return offset;
}
public int getSize() {
return size;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (offset ^ (offset >>> 32));
result = prime * result + size;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
IndexDetails other = (IndexDetails) obj;
if (offset != other.offset)
return false;
if (size != other.size)
return false;
return true;
}
@Override
public String toString() {
return "IndexDetails [offset=" + offset + ", size=" + size + "]";
}
}