Generic string->value map that is stored in a given block.

This class is described in detail in Generic Containers article.

Constructor

new (b:Block, a:String)

Creates a new generic key-value map on top of cache block.

Parameters:

b

Cache block.

a

Block attribute name.

Methods

clear ():Void

Clear map contents.

decrease (key:String, ?value:Int):Void

Decreases Int value by a given amount.

Parameters:

key

Map key.

value

Amount to decrease by. Defaults to 1.

getDynamic (key:String):Dynamic

Returns map value as Dynamic.

Parameters:

key

Map key.

Returns:

Map value. Returns null, if this mapping is not found.

getFloat (key:String):Float

Returns map value as Float.

Parameters:

key

Map key.

Returns:

Map value. Returns 0, if this mapping is not found.

getInt (key:String):Int

Returns map value as Int.

Parameters:

key

Map key.

Returns:

Map value. Returns 0, if this mapping is not found.

getString (key:String):String

Returns map value as String.

Parameters:

key

Map key.

Returns:

Map value. Returns null, if this mapping is not found.

increase (key:String, ?value:Int):Void

Increases Int value by a given amount.

Parameters:

key

Map key.

value

Amount to increase by. Defaults to 1.

set (key:String, val:Dynamic):Void

Maps key to a given value. If the new value equals the old one, nothing happens. If the new value is 0, the mapping will be deleted. Will call the setPre() and setPost() hooks.

Parameters:

key

Map key.

val

New value.

dynamic setPost (key:String, oldValue:Dynamic, value:Dynamic):Void

This method is called after mapping values.

Parameters:

key

Map key.

oldValue

Old value.

value

New value.

dynamic setPre (key:String, oldValue:Dynamic, value:Dynamic):Bool

This method is called before mapping values. If it returns false, the value will not be changed.

Parameters:

key

Map key.

oldValue

Old value.

value

New value.

Returns:

True, if setting value should be allowed. False otherwise.