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