package at.yawk.numaec;
import org.eclipse.collections.api.map.primitive.ByteByteMap;
public final class MutableByteByteBTreeMapFactory implements MutableByteByteBufferMapFactory {
private final LargeByteBufferAllocator allocator;
private final BTreeConfig config;
private MutableByteByteBTreeMapFactory(LargeByteBufferAllocator allocator, BTreeConfig config) {
this.allocator = allocator;
this.config = config;
}
public static MutableByteByteBufferMapFactory withAllocator(LargeByteBufferAllocator allocator) {
return withAllocatorAndConfig(allocator, BTreeConfig.builder().build());
}
public static MutableByteByteBufferMapFactory withAllocatorAndConfig(
LargeByteBufferAllocator allocator, BTreeConfig config
) {
return new MutableByteByteBTreeMapFactory(allocator, config);
}
@Override
public MutableByteByteBufferMap empty() {
return new ByteByteBTreeMap.Mutable(allocator, config);
}
@Override
public MutableByteByteBufferMap ofInitialCapacity(int capacity) {
return empty();
}
@Override
public MutableByteByteBufferMap ofAll(ByteByteMap map) {
MutableByteByteBufferMap n = ofInitialCapacity(map.size());
n.putAll(map);
return n;
}
}