AI::ExpertSystem::Advanced::Dictionary - Array/hash dictionary
The dictionary offers a unified interface for:
An array with all the keys of
Useful for creating the
iterable_array and for knowing the order of the items as they get added or removed.
The original hash,
has all the elements with all their properties (eg extra keys).
The disadvantage of it is that it doesn't keeps the order of the elements,
hence the need of
Used by the
It starts as a copy of
stack and as the iterate methods start running this array starts getting reduced until it gets to an empty list.
Looks for a given value (
By default it will look for the value by reading the
id of each item,
however this can be changed by passing a different hash key (
In case there's no match
undef is returned.
The AI::ExpertSystem::Advanced::Dictionary consists of a hash of elements, each element has its own properties (eg, extra keys).
This method looks for the value of the given
$key of a given element
It will return the value,
but if element doesn't have the given
undef will be returned.
Adds a new element to the
The element gets added to the end of
$id parameter specifies the id of the new element and the next parameter is a stack of extra keys.
but the element gets added to the top of the
Updates the extra keys of the element that matches the given
Please note that it will only update or add new keys.
So if the given element already has a key and this is not provided in
%extra_keys then it wont be modified.
Removes the element that matches the given
Returns true if the removal is successful, otherwise false is returned.
Returns the size of
Returns the first element of the
iterable_array is reduced by one.
If no more items are found in
undef is returned.
but instead of returning the first element,
it returns the last element of
iterable_array gets populated when a dictionary instance is created,
however if new items are added or removed then it's extremely needed to call this method so
iterable_array gets populated again.
Pablo Fischer (firstname.lastname@example.org).
Copyright (C) 2010 by Pablo Fischer.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.