Module ec_gb_trees

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

Copyright © 2011 Erlware, LLC.

Behaviours: ec_dictionary.

Authors: Eric Merritt (ericbmerritt@gmail.com).

Description

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

Function Index

add/3add a new value to the existing dictionary.
from_list/1
get/2given a key return that key from the dictionary.
get/3
has_key/2check to see if the dictionary provided has the specified key.
has_value/2Check to see if the value exists in the dictionary.
keys/1
new/0create a new dictionary object from the specified module.
remove/2Remove a value from the dictionary returning a new dictionary with the value removed.
size/1return the current number of key value pairs in the dictionary.
to_list/1

Function Details

add/3

add(Key::ec_dictionary:key(K), Value::ec_dictionary:value(V), Object::gb_trees:tree(K, V)) -> gb_trees:tree(K, V)

Key: the key to add
Value: the value to add
Object: the dictionary object to add too

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

from_list/1

from_list(List::[{ec_dictionary:key(K), ec_dictionary:value(V)}]) -> gb_trees:tree(K, V)

get/2

get(Key::ec_dictionary:key(K), Object::gb_trees:tree(K, V)) -> ec_dictionary:value(V)

Key: The key requested when the key does not exist @throws not_found
Object: The dictionary object to return the value from

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

get/3

get(Key::ec_dictionary:key(K), Default::ec_dictionary:value(V), Object::gb_trees:tree(K, V)) -> ec_dictionary:value(V)

has_key/2

has_key(Key::ec_dictionary:key(K), Object::gb_trees:tree(K, _V)) -> boolean()

Key: The key to check the dictionary for
Object: The dictory object to check

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

has_value/2

has_value(Value::ec_dictionary:value(V), Object::gb_trees:tree(_K, V)) -> boolean()

Value: The value to check if exists
Object: the dictionary object to check

Check to see if the value exists in the dictionary

keys/1

keys(Data::gb_trees:tree(K, _V)) -> [ec_dictionary:key(K)]

new/0

new() -> gb_trees:tree(_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.

remove/2

remove(Key::ec_dictionary:key(K), Object::gb_trees:tree(K, V)) -> gb_trees:tree(K, V)

Key: the key of the key/value pair to remove
Object: the dictionary object to remove the value from

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

size/1

size(Object::gb_trees:tree(_K, _V)) -> non_neg_integer()

Object: the object return the size for.

return the current number of key value pairs in the dictionary

to_list/1

to_list(Data::gb_trees:tree(K, V)) -> [{ec_dictionary:key(K), ec_dictionary:value(V)}]


Generated by EDoc, Feb 15 2022, 15:17:47.