package org.terracotta.offheapstore.storage;
import org.terracotta.offheapstore.storage.StorageEngine.Owner;
public final class BooleanHalfStorageEngine implements HalfStorageEngine<Boolean> {
public static final BooleanHalfStorageEngine INSTANCE = new BooleanHalfStorageEngine();
private BooleanHalfStorageEngine() {
}
@Override
public Integer write(Boolean object, int hash) {
return object ? 1 : 0;
}
@Override
public void free(int encoding) {
}
@Override
public Boolean read(int encoding) {
return encoding == 1;
}
@Override
public boolean equals(Object object, int encoding) {
return object instanceof Boolean && write((Boolean) object, 0) == encoding;
}
@Override
public void clear() {
}
@Override
public long getAllocatedMemory() {
return 0L;
}
@Override
public long getOccupiedMemory() {
return 0L;
}
@Override
public long getVitalMemory() {
return 0L;
}
@Override
public long getDataSize() {
return 0;
}
@Override
public void invalidateCache() {
}
@Override
public void bind(Owner owner, long mask) {
}
@Override
public void destroy() {
}
@Override
public boolean shrink() {
return false;
}
}