HashCodeFactory
| Kind of class: | public class |
|---|---|
| Package: | com.bourre.core |
| Inherits from: | none |
| Classpath: | com.bourre.core.HashCodeFactory |
| File last modified: | Monday, 24 November 2008, 11:36:49 |
The
to emulate the behavior of the Java™
instance in an application.
HashCodeFactory class provides convenient methodsto emulate the behavior of the Java™
Object.hashcode()method. The hashcode factory provides an unique identifier for anyinstance in an application.
However, there is a major difference between the Java™ behavior
and the Flash™ behavior. In Java™ the hashcode method
will return the same value for two different instance of the same
class which have the same properties value, in Flash™ the
hashcode factory will return a different identifier for all instances
even if their properties are equals.
Summary
Class methods
- getKey (o:*) : String
- Returns the hashcode key associated to the passed-in object.
- hasKey (o:*) : Boolean
- Returns true if the passed-in object already
- getNextKey : String
- Returns the next unique identifier, two consecutives
- previewNextKey : String
- Returns the next key the getNextKeywill return, without causing the getNextKeymethod returning a different key.
Class methods
getKey
public static function getKey (
o:*) : String
Returns the hashcode key associated to the passed-in object.
If the objects has not yet a hashcode, the function will generate
one and then register the object with its hashcode.
If the objects has not yet a hashcode, the function will generate
one and then register the object with its hashcode.
Parameters:
o:
object for which get the hashcode key
Returns:
- the string hashcode for the passed-in object
getNextKey
public static function getNextKey (
) : String
Returns the next unique identifier, two consecutives
call to the
different keys. To get the next key without changing
the next call result use the
call to the
getNextKey will generate twodifferent keys. To get the next key without changing
the next call result use the
previewNextKeymethod. Returns:
- the next unique identifier
See also:
hasKey
public static function hasKey (
o:*) : Boolean
Returns
have a hashcode key.
true if the passed-in object alreadyhave a hashcode key.
Parameters:
o:
object for which verify the presence of a hashcode key
Returns:
-
trueif the passed-in object already
have a hashcode key
previewNextKey
public static function previewNextKey (
) : String
Returns the next key the
the
the next call of the
getNextKeywill return, without causing the getNextKeymethod returning a different key. Calling several timesthe
previewNextKey method will never affectthe next call of the
getNextKey method. Returns:
- a preview of the next unique identifier