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