All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.davidmoten.bplustree.internal.Options Maven / Gradle / Ivy

Go to download

B+-tree using Memory Mapped Files, supports range queries and duplicate keys

There is a newer version: 0.1.4
Show newest version
package com.github.davidmoten.bplustree.internal;

import java.util.Comparator;

import com.github.davidmoten.guavamini.Preconditions;

public final class Options {

    /** the maximum number of keys in the leaf node, M must be > 0 */
    private final int maxLeafKeys;

    /**
     * the maximum number of keys in inner node, the number of pointer is N+1, N
     * must be > 2
     */
    private final int maxNonLeafKeys;
    private final Comparator comparator;
    private final boolean uniqueKeys;
    private final FactoryProvider factoryProvider;

    public Options(int maxLeafKeys, int maxNonLeafKeys, boolean uniqueKeys, 
            Comparator comparator, FactoryProvider factoryProvider) {
        // only one byte used to store num keys so check values
        Preconditions.checkArgument(0 < maxLeafKeys && maxLeafKeys <= 255);
        Preconditions.checkArgument(0 < maxNonLeafKeys && maxNonLeafKeys <= 255);
        this.maxLeafKeys = maxLeafKeys;
        this.maxNonLeafKeys = maxNonLeafKeys;
        this.comparator = comparator;
        this.uniqueKeys = uniqueKeys;
        this.factoryProvider = factoryProvider;
    }

    public int maxLeafKeys() {
        return maxLeafKeys;
    }

    public int maxNonLeafKeys() {
        return maxNonLeafKeys;
    }

    public Comparator comparator() {
        return comparator;
    }

    public boolean uniqueKeys() {
        return uniqueKeys;
    }
    
    public FactoryProvider factoryProvider() {
        return factoryProvider;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy