Copyright | Copyright (c) 2015 Birte Wagner Sebastian Philipp |
---|---|
License | MIT |
Maintainer | Birte Wagner, Sebastian Philipp ([email protected]) |
Stability | experimental |
Portability | not portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Data.RTree.Base
Description
Internal implementations. Use RTree
instead or use at you own risc.
Synopsis
- data RTree a
- empty :: RTree a
- singleton :: MBB -> a -> RTree a
- insert :: MBB -> a -> RTree a -> RTree a
- insertWith :: (a -> a -> a) -> MBB -> a -> RTree a -> RTree a
- delete :: MBB -> RTree a -> RTree a
- mapMaybe :: (a -> Maybe b) -> RTree a -> RTree b
- union :: RTree a -> RTree a -> RTree a
- unionWith :: (a -> a -> a) -> RTree a -> RTree a -> RTree a
- lookup :: MBB -> RTree a -> Maybe a
- intersectWithKey :: MBB -> RTree a -> [(MBB, a)]
- intersect :: MBB -> RTree a -> [a]
- lookupRange :: MBB -> RTree a -> [a]
- lookupRangeWithKey :: MBB -> RTree a -> [(MBB, a)]
- lookupContainsRangeWithKey :: MBB -> RTree a -> [(MBB, a)]
- lookupContainsRange :: MBB -> RTree a -> [a]
- length :: RTree a -> Int
- null :: RTree a -> Bool
- keys :: RTree a -> [MBB]
- values :: RTree a -> [a]
- fromList :: [(MBB, a)] -> RTree a
- toList :: RTree a -> [(MBB, a)]
- foldWithMBB :: (MBB -> a -> b) -> (MBB -> [b] -> b) -> b -> RTree a -> b
- pp :: Show a => RTree a -> IO ()
- isValid :: Show b => b -> RTree a -> Bool
- unionDistinct :: RTree a -> RTree a -> RTree a
- unionDistinctWith :: (a -> a -> a) -> RTree a -> RTree a -> RTree a
- fromList' :: [RTree a] -> RTree a
- unionDistinctSplit :: (a -> a -> a) -> RTree a -> RTree a -> [RTree a]
- depth :: RTree a -> Int
- areaIncreasesWith :: RTree a -> RTree a -> Double
- partition :: (a -> Bool) -> [a] -> ([a], [a])
- getChildren :: RTree a -> [RTree a]
- unionMBB' :: RTree a -> RTree a -> MBB
- createNodeWithChildren :: [RTree a] -> RTree a
- n :: Int
- splitNode :: RTree a -> [RTree a]
- node :: MBB -> [RTree a] -> RTree a
Data Type
Instances
Constructors
Modification
insert :: MBB -> a -> RTree a -> RTree a Source #
Inserts an element whith the given MBB
and a value in a tree. An existing value will be overwritten with the given one.
insert = insertWith const
insertWith :: (a -> a -> a) -> MBB -> a -> RTree a -> RTree a Source #
Inserts an element whith the given MBB
and a value in a tree. The combining function will be used if the value already exists.
delete :: MBB -> RTree a -> RTree a Source #
Delete a key and its value from the RTree. When the key is not a member of the tree, the original tree is returned.
Merging
union :: RTree a -> RTree a -> RTree a Source #
Unifies the first and the second tree into one.
If an MBB
is a key in both trees, the value from the left tree is chosen.
union = unionWith const
unionWith :: (a -> a -> a) -> RTree a -> RTree a -> RTree a Source #
Unifies the first and the second tree into one. The combining function is used for elemets which exists in both trees.
Searching and Properties
intersectWithKey :: MBB -> RTree a -> [(MBB, a)] Source #
returns all keys and values, which intersects with the given bounding box.
intersect :: MBB -> RTree a -> [a] Source #
returns all values, which intersects with the given bounding box.
lookupRange :: MBB -> RTree a -> [a] Source #
returns all values, which are located in the given bounding box.
lookupRangeWithKey :: MBB -> RTree a -> [(MBB, a)] Source #
returns all keys and values, which are located in the given bounding box.
lookupContainsRangeWithKey :: MBB -> RTree a -> [(MBB, a)] Source #
returns all keys and values containing the given bounding box
lookupContainsRange :: MBB -> RTree a -> [a] Source #
returns all values containing the given bounding box
Lists
toList :: RTree a -> [(MBB, a)] Source #
creates a list of pairs out of a tree
toList t = zip (keys t) (values t)
Internal and Testing
partition :: (a -> Bool) -> [a] -> ([a], [a]) #
The partition
function takes a predicate a list and returns
the pair of lists of elements which do and do not satisfy the
predicate, respectively; i.e.,
partition p xs == (filter p xs, filter (not . p) xs)
>>>
partition (`elem` "aeiou") "Hello World!"
("eoo","Hll Wrld!")
getChildren :: RTree a -> [RTree a] Source #
createNodeWithChildren :: [RTree a] -> RTree a Source #
It is possible, to change these constants, but the tree won't be space optimal anymore.