module Data.BTree.Pure.Setup (
TreeSetup(..)
, twoThreeSetup
, setupWithMinimumDegreeOf
) where
data TreeSetup = TreeSetup {
minFanout :: Int
, maxFanout :: Int
, minIdxKeys :: Int
, maxIdxKeys :: Int
, minLeafItems :: Int
, maxLeafItems :: Int
} deriving (Show)
twoThreeSetup :: TreeSetup
twoThreeSetup = TreeSetup {
minFanout = minFanout'
, maxFanout = maxFanout'
, minIdxKeys = minFanout' 1
, maxIdxKeys = maxFanout' 1
, minLeafItems = minFanout'
, maxLeafItems = 2*minFanout' 1
}
where
minFanout' = 2
maxFanout' = 2*minFanout' 1
setupWithMinimumDegreeOf :: Int -> TreeSetup
setupWithMinimumDegreeOf deg = TreeSetup {
minFanout = minFanout'
, maxFanout = maxFanout'
, minIdxKeys = minFanout' 1
, maxIdxKeys = maxFanout' 1
, minLeafItems = minFanout' 1
, maxLeafItems = maxFanout' 1
}
where
minFanout' = deg
maxFanout' = 2*deg