Package org.chaidb.db.index

Source Code of org.chaidb.db.index.BTreeFactory

/*
* Copyright (C) 2006  http://www.chaidb.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
*/

/**
* User: Administrator
* Date: Nov 11, 2003
* Time: 1:06:37 PM
*/
package org.chaidb.db.index;

import org.chaidb.db.index.btree.BTree;
import org.chaidb.db.index.btree.PathBTree;
import org.chaidb.db.index.btree.hbt.HyperBTree;

/**
* BTreeFactory is the factory class to get BTree instance.
*/
public class BTreeFactory {
    /**
     * create an instance of BTree.
     *
     * @param btreeType There are 2 types of BTree
     *                  BTREE - basic btree, one key to one value
     *                  HYPERBTREE - duplicated key, one key to multiple values
     * @return an BTree instance which type is specifed by btreeType
     */
    public static IDBIndex createBTree(short btreeType) {
        switch (btreeType) {
            case IBTreeConst.ID2NODE_BTREE:
                return new org.chaidb.db.index.btree.Id2nodeBTree();
            case IBTreeConst.SUPER_BTREE:
                return new org.chaidb.db.index.btree.SuperBTree();
            case IBTreeConst.HYPER_BTREE:
                return new HyperBTree();
            case IBTreeConst.PATH_BTREE:
                return new PathBTree();
            case IBTreeConst.BTREE:
                return new BTree();
            default:
                return new BTree();
        }
    }

}
TOP

Related Classes of org.chaidb.db.index.BTreeFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.