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