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