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