| Package | starling.utils |
| Class | public class Pool |
| Inheritance | Pool Object |
If you want to retrieve an object, but the pool does not contain any more instances, it will silently create a new one.
It's important that you use the pool in a balanced way, i.e. don't just "get" or "put" alone! Always make the calls in pairs; whenever you get an object, be sure to put it back later, and the other way round. Otherwise, the pool will empty or (even worse) grow in size uncontrolled.
| Method | Defined By | ||
|---|---|---|---|
getMatrix(a:Number = 1, b:Number = 0, c:Number = 0, d:Number = 1, tx:Number = 0, ty:Number = 0):Matrix [static] Retrieves a Matrix instance from the pool. | Pool | ||
getMatrix3D(identity:Boolean = true):Matrix3D [static] Retrieves a Matrix3D instance from the pool. | Pool | ||
getPoint(x:Number = 0, y:Number = 0):Point [static] Retrieves a Point instance from the pool. | Pool | ||
getPoint3D(x:Number = 0, y:Number = 0, z:Number = 0):Vector3D [static] Retrieves a Vector3D instance from the pool. | Pool | ||
getRectangle(x:Number = 0, y:Number = 0, width:Number = 0, height:Number = 0):Rectangle [static] Retrieves a Rectangle instance from the pool. | Pool | ||
putMatrix(matrix:Matrix):void [static] Stores a Matrix instance in the pool. | Pool | ||
putMatrix3D(matrix:Matrix3D):void [static] Stores a Matrix3D instance in the pool. | Pool | ||
putPoint(point:Point):void [static] Stores a Point instance in the pool. | Pool | ||
putPoint3D(point:Vector3D):void [static] Stores a Vector3D instance in the pool. | Pool | ||
putRectangle(rectangle:Rectangle):void [static] Stores a Rectangle instance in the pool. | Pool | ||
| getMatrix | () | method |
public static function getMatrix(a:Number = 1, b:Number = 0, c:Number = 0, d:Number = 1, tx:Number = 0, ty:Number = 0):MatrixRetrieves a Matrix instance from the pool.
Parameters
a:Number (default = 1) | |
b:Number (default = 0) | |
c:Number (default = 0) | |
d:Number (default = 1) | |
tx:Number (default = 0) | |
ty:Number (default = 0) |
Matrix |
| getMatrix3D | () | method |
public static function getMatrix3D(identity:Boolean = true):Matrix3DRetrieves a Matrix3D instance from the pool.
Parameters
identity:Boolean (default = true) — If enabled, the matrix will be reset to the identity.
Otherwise, its contents is undefined.
|
Matrix3D |
| getPoint | () | method |
public static function getPoint(x:Number = 0, y:Number = 0):PointRetrieves a Point instance from the pool.
Parameters
x:Number (default = 0) | |
y:Number (default = 0) |
Point |
| getPoint3D | () | method |
public static function getPoint3D(x:Number = 0, y:Number = 0, z:Number = 0):Vector3DRetrieves a Vector3D instance from the pool.
Parameters
x:Number (default = 0) | |
y:Number (default = 0) | |
z:Number (default = 0) |
Vector3D |
| getRectangle | () | method |
public static function getRectangle(x:Number = 0, y:Number = 0, width:Number = 0, height:Number = 0):RectangleRetrieves a Rectangle instance from the pool.
Parameters
x:Number (default = 0) | |
y:Number (default = 0) | |
width:Number (default = 0) | |
height:Number (default = 0) |
Rectangle |
| putMatrix | () | method |
public static function putMatrix(matrix:Matrix):voidStores a Matrix instance in the pool. Don't keep any references to the object after moving it to the pool!
Parameters
matrix:Matrix |
| putMatrix3D | () | method |
public static function putMatrix3D(matrix:Matrix3D):voidStores a Matrix3D instance in the pool. Don't keep any references to the object after moving it to the pool!
Parameters
matrix:Matrix3D |
| putPoint | () | method |
public static function putPoint(point:Point):voidStores a Point instance in the pool. Don't keep any references to the object after moving it to the pool!
Parameters
point:Point |
| putPoint3D | () | method |
public static function putPoint3D(point:Vector3D):voidStores a Vector3D instance in the pool. Don't keep any references to the object after moving it to the pool!
Parameters
point:Vector3D |
| putRectangle | () | method |
public static function putRectangle(rectangle:Rectangle):voidStores a Rectangle instance in the pool. Don't keep any references to the object after moving it to the pool!
Parameters
rectangle:Rectangle |