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