Permalink
Browse files

vclock: simplification of descends/2

  • Loading branch information...
1 parent c4fe87f commit e58c769f7740c4c4dabca5febc9e44bd76713693 @esstrifork esstrifork committed with Vagabond Apr 8, 2011
Showing with 6 additions and 15 deletions.
  1. +6 −15 src/vclock.erl
View
@@ -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.

0 comments on commit e58c769

Please sign in to comment.