68 lines
1.5 KiB
Java
68 lines
1.5 KiB
Java
package org.warp.jcwdb;
|
|
|
|
import java.util.Objects;
|
|
|
|
public class IndexDetails {
|
|
/**
|
|
* The bitmask is used to determine if an index has been deleted
|
|
*/
|
|
public static final int BITMASK = 1; // 1 byte
|
|
public static final int OFFSET_BYTES = Long.SIZE;
|
|
public static final int DATA_SIZE_BYTES = Integer.SIZE;
|
|
public static final int TYPE_BYTES = Integer.SIZE;
|
|
public static final int TOTAL_BYTES = BITMASK + OFFSET_BYTES + DATA_SIZE_BYTES + TYPE_BYTES;
|
|
public static final byte MASK_DELETED = 0b00000001;
|
|
private final long offset;
|
|
private final int size;
|
|
private final int type;
|
|
|
|
public IndexDetails(long offset, int size, int type) {
|
|
this.offset = offset;
|
|
this.size = size;
|
|
this.type = type;
|
|
}
|
|
|
|
public IndexDetails(IndexDetails indexDetails) {
|
|
this.offset = indexDetails.offset;
|
|
this.size = indexDetails.size;
|
|
this.type = indexDetails.type;
|
|
}
|
|
|
|
public long getOffset() {
|
|
return offset;
|
|
}
|
|
|
|
public int getSize() {
|
|
return size;
|
|
}
|
|
|
|
public int getType() {
|
|
return type;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o) return true;
|
|
if (o == null || getClass() != o.getClass()) return false;
|
|
IndexDetails that = (IndexDetails) o;
|
|
return offset == that.offset &&
|
|
size == that.size &&
|
|
type == that.type;
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return Objects.hash(offset);
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "IndexDetails{" +
|
|
"offset=" + offset +
|
|
", size=" + size +
|
|
", type=" + type +
|
|
'}';
|
|
}
|
|
|
|
}
|