Skip to content

Commit

Permalink
vclock: simplification of descends/2
Browse files Browse the repository at this point in the history
  • Loading branch information
esstrifork authored and Vagabond committed Jun 6, 2011
1 parent c4fe87f commit e58c769
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/vclock.erl
Expand Up @@ -64,21 +64,12 @@ descends(_, []) ->
true;
descends(Va, Vb) ->
[{NodeB, {CtrB, _T}}|RestB] = Vb,
CtrA =
case lists:keyfind(NodeB, 1, Va) of
false -> false;
{_, {CA, _TSA}} -> CA
end,
case CtrA of
false -> false;
_ ->
if
CtrA < CtrB ->
false;
true ->
descends(Va,RestB)
end
end.
case lists:keyfind(NodeB, 1, Va) of
false ->
false;
{_, {CtrA, _TSA}} ->
(CtrA >= CtrB) andalso descends(Va,RestB)
end.

% @doc Combine all VClocks in the input list into their least possible
% common descendant.
Expand Down

0 comments on commit e58c769

Please sign in to comment.