Trees | Indices | Toggle frames |
---|
Rectangular area allocation algorithm.
Initialise with a given width and height, then repeatedly call alloc to retrieve free regions of the area and protect that area from future allocations.
Allocator uses a fairly simple strips-based algorithm. It performs best when rectangles are allocated in decreasing height order.
__init__(self,
width,
height)
Create an Allocator of the given size.
|
|
int, int |
alloc(self,
width,
height)
Get a free area in the allocator of the given size.
|
float |
get_usage(self)
Get the fraction of area already allocated.
|
float |
get_fragmentation(self)
Get the fraction of area that's unlikely to ever be used, based on
current allocation behaviour.
|
Get a free area in the allocator of the given size.
After calling alloc, the requested area will no longer be used. If there is not enough room to fit the given area AllocatorException is raised.
Get the fraction of area already allocated.
This method is useful for debugging and profiling only.
Get the fraction of area that's unlikely to ever be used, based on current allocation behaviour.
This method is useful for debugging and profiling only.
Trees | Indices | Toggle frames |
---|
Generated by Epydoc 3.0beta1 on Thu Dec 31 17:58:19 2009 | http://epydoc.sourceforge.net |