ec_gb_trees

This provides an implementation of the type ec_dictionary using gb_trees as a backin see ec_dictionary see gb_trees.

This provides an implementation of the type ec_dictionary using gb_trees as a backin see ec_dictionary see gb_trees

DATA TYPES

dictionary(K, V) = {non_neg_integer(), ec_gb_tree_node(K, V)}
ec_gb_tree_node(K, V) = nil | {K, V, ec_gb_tree_node(K, V), ec_gb_tree_node(K, V)}

Functions


new() -> dictionary(_K, _V)

create a new dictionary object from the specified module. The module should implement the dictionary behaviour. In the clause where an existing object is passed in new empty dictionary of the same implementation is created and returned.

has_key(Key::key(K) (see module ec_dictionary), Object::dictionary(K, _V)) -> boolean()

check to see if the dictionary provided has the specified key.

get(Key::key(K) (see module ec_dictionary), Object::dictionary(K, V)) -> value(V) (see module ec_dictionary)

given a key return that key from the dictionary. If the key is not found throw a 'not_found' exception.

get(Key::key(K) (see module ec_dictionary), Default::value(V) (see module ec_dictionary), Object::dictionary(K, V)) -> value(V) (see module ec_dictionary)

add(Key::key(K) (see module ec_dictionary), Value::value(V) (see module ec_dictionary), Object::dictionary(K, V)) -> dictionary(K, V)

add a new value to the existing dictionary. Return a new dictionary containing the value.

remove(Key::key(K) (see module ec_dictionary), Object::dictionary(K, V)) -> dictionary(K, V)

Remove a value from the dictionary returning a new dictionary with the value removed.

has_value(Value::value(V) (see module ec_dictionary), Object::dictionary(_K, V)) -> boolean()

Check to see if the value exists in the dictionary

size(Object::dictionary(_K, _V)) -> non_neg_integer()

return the current number of key value pairs in the dictionary

to_list(Data::dictionary(K, V)) -> [{key(K) (see module ec_dictionary), value(V) (see module ec_dictionary)}]

from_list(List::[{key(K) (see module ec_dictionary), value(V) (see module ec_dictionary)}]) -> dictionary(K, V)

keys(Data::dictionary(K, _V)) -> [key(K) (see module ec_dictionary)]

Eric Merritt ericbmerritt@gmail.com
View Functions