TPriorityMap implements a collection that takes key-value pairs with
a priority to allow key-value pairs to be ordered. This ordering is
important when flattening the map. When flattening the map, if some
key-value pairs are required to be before or after others, use this
class to keep order to your map.
You can access, add or remove an item with a key by using
{@link itemAt}, {@link add}, and {@link remove}. These functions
can optionally take a priority parameter to allow access to specific
priorities. TPriorityMap is functionally backward compatible
with {@link TMap}.
To get the number of the items in the map, use {@link getCount}.
TPriorityMap can also be used like a regular array as follows,
$map[$key]=$value; // add a key-value pair
unset($map[$key]); // remove the value with the specified key
if(isset($map[$key])) // if the map contains the key
foreach($map as $key=>$value) // traverse the items in the map
$n=count($map); // returns the number of items in the map
Using standard array access method like these will always use
the default priority.
An item that doesn't specify a priority will receive the default
priority. The default priority is set during the instantiation
of a new TPriorityMap. If no custom default priority is specified,
the standard default priority of 10 is used.
Priorities with significant digits below precision will be rounded.
A priority may also be a numeric with decimals. This is set
during the instantiation of a new TPriorityMap.
The default is 8 decimal places for a priority. If a negative number
is used, rounding occurs into the integer space rather than in
the decimal space. See {@link round}.