TilePool

public class
loom.modestmaps.core.painter.TilePool

Description

This post http://lab.polygonal.de/2008/06/18/using-object-pools/ suggests that using Object pools, especially for complex classes like Sprite is a lot faster than calling new Object(). The suggested implementation uses a linked list, but to get started with it here I'm using an Array.

If anyone wants to try it with a linked list and compare the times, it seems like it could be worth it :)

API overview

Constructor

TilePool ( tileCreator: Function )

Attributes

Protected attributes

Constants

Constants

MAX_NEW_TILES: Number static
MIN_POOL_SIZE: Number static

Functions

Public functions

getTile ( column: Number , row: Number , zoom: Number ): Tile
returnTile ( tile: Tile ): Void
setTileCreator ( tileCreator: Function ): Void

Constructor

TilePool ( tileCreator: Function )

Attributes

Protected attributes

Constants

MAX_NEW_TILES: Number

static

MIN_POOL_SIZE: Number

static

Functions

getFullTypeName (): String
Inherited from Object

native

Gets the fully qualified type name of the Object. The fully qualified type name includes the package of the type.


Returns

String fully qualified type name of the Object.

getTile ( column: Number , row: Number , zoom: Number ): Tile

Parameters

column: Number
row: Number
zoom: Number


getType (): Type
Inherited from Object

native

Gets the Type that describes the Object.


Returns

Type The Type that describes the object.

getTypeName (): String
Inherited from Object

native

Gets the type name of the Object.


Returns

String type name of the Object.

returnTile ( tile: Tile ): Void

Parameters

tile: Tile


setTileCreator ( tileCreator: Function ): Void

Parameters

tileCreator: Function


toString (): String
Inherited from Object

native

Returns a String that describes the Object. This can be overriden to provide extra details when printing objects using trace().


Returns

String String that described the Object.

: