fix edoc errors in various modules
Signed-off-by: Jordan Wilberding <diginux@gmail.com>
This commit is contained in:
parent
51b5a41c63
commit
d7b60ccf19
6 changed files with 49 additions and 49 deletions
|
@ -4,8 +4,8 @@
|
||||||
%%% @doc
|
%%% @doc
|
||||||
%%% provides an implementation of ec_dictionary using an association
|
%%% provides an implementation of ec_dictionary using an association
|
||||||
%%% list as a basy
|
%%% list as a basy
|
||||||
|
%%% see ec_dictionary
|
||||||
%%% @end
|
%%% @end
|
||||||
%%% @see ec_dictionary
|
|
||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
-module(ec_assoc_list).
|
-module(ec_assoc_list).
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
%%% This provides an implementation of the ec_dictionary type using
|
%%% This provides an implementation of the ec_dictionary type using
|
||||||
%%% erlang dicts as a base. The function documentation for
|
%%% erlang dicts as a base. The function documentation for
|
||||||
%%% ec_dictionary applies here as well.
|
%%% ec_dictionary applies here as well.
|
||||||
|
%%% see ec_dictionary
|
||||||
|
%%% see dict
|
||||||
%%% @end
|
%%% @end
|
||||||
%%% @see ec_dictionary
|
|
||||||
%%% @see dict
|
|
||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
-module(ec_dict).
|
-module(ec_dict).
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ has_key(Key, #dict_t{callback = Mod, data = Data}) ->
|
||||||
%%
|
%%
|
||||||
%% @param Dict The dictionary object to return the value from
|
%% @param Dict The dictionary object to return the value from
|
||||||
%% @param Key The key requested
|
%% @param Key The key requested
|
||||||
%% @throws not_found when the key does not exist
|
%% when the key does not exist @throws not_found
|
||||||
-spec get(key(K), dictionary(K, V)) -> value(V).
|
-spec get(key(K), dictionary(K, V)) -> value(V).
|
||||||
get(Key, #dict_t{callback = Mod, data = Data}) ->
|
get(Key, #dict_t{callback = Mod, data = Data}) ->
|
||||||
Mod:get(Key, Data).
|
Mod:get(Key, Data).
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
%%% @doc
|
%%% @doc
|
||||||
%%% This provides an implementation of the type ec_dictionary using
|
%%% This provides an implementation of the type ec_dictionary using
|
||||||
%%% gb_trees as a backin
|
%%% gb_trees as a backin
|
||||||
|
%%% see ec_dictionary
|
||||||
|
%%% see gb_trees
|
||||||
%%% @end
|
%%% @end
|
||||||
%%% @see ec_dictionary
|
|
||||||
%%% @see gb_trees
|
|
||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
-module(ec_gb_trees).
|
-module(ec_gb_trees).
|
||||||
|
|
||||||
|
@ -14,16 +14,16 @@
|
||||||
|
|
||||||
%% API
|
%% API
|
||||||
-export([new/0,
|
-export([new/0,
|
||||||
has_key/2,
|
has_key/2,
|
||||||
get/2,
|
get/2,
|
||||||
get/3,
|
get/3,
|
||||||
add/3,
|
add/3,
|
||||||
remove/2,
|
remove/2,
|
||||||
has_value/2,
|
has_value/2,
|
||||||
size/1,
|
size/1,
|
||||||
to_list/1,
|
to_list/1,
|
||||||
from_list/1,
|
from_list/1,
|
||||||
keys/1]).
|
keys/1]).
|
||||||
|
|
||||||
-export_type([dictionary/2]).
|
-export_type([dictionary/2]).
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@
|
||||||
-opaque dictionary(K, V) :: {non_neg_integer(), ec_gb_tree_node(K, V)}.
|
-opaque dictionary(K, V) :: {non_neg_integer(), ec_gb_tree_node(K, V)}.
|
||||||
|
|
||||||
-type ec_gb_tree_node(K, V) :: 'nil' | {K, V,
|
-type ec_gb_tree_node(K, V) :: 'nil' | {K, V,
|
||||||
ec_gb_tree_node(K, V),
|
ec_gb_tree_node(K, V),
|
||||||
ec_gb_tree_node(K, V)}.
|
ec_gb_tree_node(K, V)}.
|
||||||
|
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
%%% API
|
%%% API
|
||||||
|
@ -57,10 +57,10 @@ new() ->
|
||||||
-spec has_key(ec_dictionary:key(K), Object::dictionary(K, _V)) -> boolean().
|
-spec has_key(ec_dictionary:key(K), Object::dictionary(K, _V)) -> boolean().
|
||||||
has_key(Key, Data) ->
|
has_key(Key, Data) ->
|
||||||
case gb_trees:lookup(Key, Data) of
|
case gb_trees:lookup(Key, Data) of
|
||||||
{value, _Val} ->
|
{value, _Val} ->
|
||||||
true;
|
true;
|
||||||
none ->
|
none ->
|
||||||
false
|
false
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @doc given a key return that key from the dictionary. If the key is
|
%% @doc given a key return that key from the dictionary. If the key is
|
||||||
|
@ -68,27 +68,27 @@ has_key(Key, Data) ->
|
||||||
%%
|
%%
|
||||||
%% @param Object The dictionary object to return the value from
|
%% @param Object The dictionary object to return the value from
|
||||||
%% @param Key The key requested
|
%% @param Key The key requested
|
||||||
%% @throws not_found when the key does not exist
|
%% when the key does not exist @throws not_found
|
||||||
-spec get(ec_dictionary:key(K), Object::dictionary(K, V)) ->
|
-spec get(ec_dictionary:key(K), Object::dictionary(K, V)) ->
|
||||||
ec_dictionary:value(V).
|
ec_dictionary:value(V).
|
||||||
get(Key, Data) ->
|
get(Key, Data) ->
|
||||||
case gb_trees:lookup(Key, Data) of
|
case gb_trees:lookup(Key, Data) of
|
||||||
{value, Value} ->
|
{value, Value} ->
|
||||||
Value;
|
Value;
|
||||||
none ->
|
none ->
|
||||||
throw(not_found)
|
throw(not_found)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec get(ec_dictionary:key(K),
|
-spec get(ec_dictionary:key(K),
|
||||||
ec_dictionary:value(V),
|
ec_dictionary:value(V),
|
||||||
Object::dictionary(K, V)) ->
|
Object::dictionary(K, V)) ->
|
||||||
ec_dictionary:value(V).
|
ec_dictionary:value(V).
|
||||||
get(Key, Default, Data) ->
|
get(Key, Default, Data) ->
|
||||||
case gb_trees:lookup(Key, Data) of
|
case gb_trees:lookup(Key, Data) of
|
||||||
{value, Value} ->
|
{value, Value} ->
|
||||||
Value;
|
Value;
|
||||||
none ->
|
none ->
|
||||||
Default
|
Default
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @doc add a new value to the existing dictionary. Return a new
|
%% @doc add a new value to the existing dictionary. Return a new
|
||||||
|
@ -98,7 +98,7 @@ get(Key, Default, Data) ->
|
||||||
%% @param Key the key to add
|
%% @param Key the key to add
|
||||||
%% @param Value the value to add
|
%% @param Value the value to add
|
||||||
-spec add(ec_dictionary:key(K), ec_dictionary:value(V),
|
-spec add(ec_dictionary:key(K), ec_dictionary:value(V),
|
||||||
Object::dictionary(K, V)) ->
|
Object::dictionary(K, V)) ->
|
||||||
dictionary(K, V).
|
dictionary(K, V).
|
||||||
add(Key, Value, Data) ->
|
add(Key, Value, Data) ->
|
||||||
gb_trees:enter(Key, Value, Data).
|
gb_trees:enter(Key, Value, Data).
|
||||||
|
@ -129,7 +129,7 @@ size(Data) ->
|
||||||
gb_trees:size(Data).
|
gb_trees:size(Data).
|
||||||
|
|
||||||
-spec to_list(dictionary(K, V)) -> [{ec_dictionary:key(K),
|
-spec to_list(dictionary(K, V)) -> [{ec_dictionary:key(K),
|
||||||
ec_dictionary:value(V)}].
|
ec_dictionary:value(V)}].
|
||||||
to_list(Data) ->
|
to_list(Data) ->
|
||||||
gb_trees:to_list(Data).
|
gb_trees:to_list(Data).
|
||||||
|
|
||||||
|
@ -137,10 +137,10 @@ to_list(Data) ->
|
||||||
dictionary(K, V).
|
dictionary(K, V).
|
||||||
from_list(List) when is_list(List) ->
|
from_list(List) when is_list(List) ->
|
||||||
lists:foldl(fun({Key, Value}, Dict) ->
|
lists:foldl(fun({Key, Value}, Dict) ->
|
||||||
gb_trees:enter(Key, Value, Dict)
|
gb_trees:enter(Key, Value, Dict)
|
||||||
end,
|
end,
|
||||||
gb_trees:empty(),
|
gb_trees:empty(),
|
||||||
List).
|
List).
|
||||||
|
|
||||||
-spec keys(dictionary(K,_V)) -> [ec_dictionary:key(K)].
|
-spec keys(dictionary(K,_V)) -> [ec_dictionary:key(K)].
|
||||||
keys(Data) ->
|
keys(Data) ->
|
||||||
|
@ -189,12 +189,12 @@ add_test() ->
|
||||||
|
|
||||||
Dict01 = ec_dictionary:add(Key1, Value1, Dict0),
|
Dict01 = ec_dictionary:add(Key1, Value1, Dict0),
|
||||||
Dict02 = ec_dictionary:add(Key3, Value3,
|
Dict02 = ec_dictionary:add(Key3, Value3,
|
||||||
ec_dictionary:add(Key2, Value2,
|
ec_dictionary:add(Key2, Value2,
|
||||||
Dict01)),
|
Dict01)),
|
||||||
Dict1 =
|
Dict1 =
|
||||||
ec_dictionary:add(Key5, Value5,
|
ec_dictionary:add(Key5, Value5,
|
||||||
ec_dictionary:add(Key4, Value4,
|
ec_dictionary:add(Key4, Value4,
|
||||||
Dict02)),
|
Dict02)),
|
||||||
|
|
||||||
?assertMatch(Value1, ec_dictionary:get(Key1, Dict1)),
|
?assertMatch(Value1, ec_dictionary:get(Key1, Dict1)),
|
||||||
?assertMatch(Value2, ec_dictionary:get(Key2, Dict1)),
|
?assertMatch(Value2, ec_dictionary:get(Key2, Dict1)),
|
||||||
|
@ -204,7 +204,7 @@ add_test() ->
|
||||||
|
|
||||||
|
|
||||||
Dict2 = ec_dictionary:add(Key3, Value5,
|
Dict2 = ec_dictionary:add(Key3, Value5,
|
||||||
ec_dictionary:add(Key2, Value4, Dict1)),
|
ec_dictionary:add(Key2, Value4, Dict1)),
|
||||||
|
|
||||||
|
|
||||||
?assertMatch(Value1, ec_dictionary:get(Key1, Dict2)),
|
?assertMatch(Value1, ec_dictionary:get(Key1, Dict2)),
|
||||||
|
@ -216,7 +216,7 @@ add_test() ->
|
||||||
|
|
||||||
?assertThrow(not_found, ec_dictionary:get(should_blow_up, Dict2)),
|
?assertThrow(not_found, ec_dictionary:get(should_blow_up, Dict2)),
|
||||||
?assertThrow(not_found, ec_dictionary:get("This should blow up too",
|
?assertThrow(not_found, ec_dictionary:get("This should blow up too",
|
||||||
Dict2)).
|
Dict2)).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
%%% This provides an implementation of the ec_dictionary type using
|
%%% This provides an implementation of the ec_dictionary type using
|
||||||
%%% erlang orddicts as a base. The function documentation for
|
%%% erlang orddicts as a base. The function documentation for
|
||||||
%%% ec_dictionary applies here as well.
|
%%% ec_dictionary applies here as well.
|
||||||
|
%%% see ec_dictionary
|
||||||
|
%%% see orddict
|
||||||
%%% @end
|
%%% @end
|
||||||
%%% @see ec_dictionary
|
|
||||||
%%% @see orddict
|
|
||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
-module(ec_orddict).
|
-module(ec_orddict).
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,8 @@
|
||||||
%%% l/rbalance, the colour, in store etc. is actually slower than not
|
%%% l/rbalance, the colour, in store etc. is actually slower than not
|
||||||
%%% doing it. Measured.
|
%%% doing it. Measured.
|
||||||
%%%
|
%%%
|
||||||
|
%%% see ec_dictionary
|
||||||
%%% @end
|
%%% @end
|
||||||
%%% @see ec_dictionary
|
|
||||||
%%%-------------------------------------------------------------------
|
%%%-------------------------------------------------------------------
|
||||||
-module(ec_rbdict).
|
-module(ec_rbdict).
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue