HashCodeFactory

Kind of class:class
Inherits from:none
Version:1.0
Author:Francis Bourre
Classpath:com.bourre.core.HashCodeFactory
File last modified:Wednesday, 31 October 2007, 07:35:29
HashCodeFactory is the corner stone of Pixlib framework.

HashCodeFactory constructor is private and can't be used.
Use only available static methods.

Gives to all Flash player objects an unique key.

Example

var nKey : Number = HashCodeFactory.getKey(this);
var nNextAvailableKey : Number = HashCodeFactory.getNextKEY();
var sNextAutoName : String = HashCodeFactory.getNextName();

Use buildInstance to build proper instance using class namespace
instead of class constructors.

Example

var o : Point = HashCodeFactory.buildInstance( "com.bourre.structures.Point", [10,2] );

Class methods

buildInstance

static function buildInstance (
sPackage:String, aArgs:Array, factoryMethod:String, singletonAccess:String)
Builds and returns new instance defined by passed-in sPackage class
namespace and aArgs constructor arguments.

Example

var o : Point = HashCodeFactory.buildInstance( "com.bourre.structures.Point", [10,2] );
Returns:
new sPackage instance

getKey

static function getKey (
) : Number
Returns passed-in o object key.
Returns:
Number

getNextKEY

static function getNextKEY (
) : Number
Returns new unique key.

Example

var nNewKey : Number = HashCodeFactory.getNextKEY();
Returns:
Number key

getNextName

static function getNextName (
) : String
Returns next available object's name.

Use for building a default name for an object.

Example

var sNextAutoName : String = HashCodeFactory.getNextName();
Returns:
Number key

isSameObject

static function isSameObject (
) : Boolean
Indicates if 2 passed-in object are equals or not.

This method is just for debugging purpose

Use === (strict equality), if you need to compare two objects.

Returns:
true if 2 passed-in objects are equal, either false

previewNextKey

static function previewNextKey (
) : Number
Preview next object key.
Returns:
Number