anchor.diff:  -export([find/5, add/6, collect/0]).
   
   %% gen_server API exports
  --export([start_link/1, init/1, terminate/2]).
  +-export([start_link/1]).
   -export([handle_call/3, handle_cast/2, handle_info/2]).
  +-export([code_change/3, init/1, terminate/2]).
   
   %%------------------------------------------------------------------------------
   %% State
  
positive.code:       {reply, hang, S0}
    end.
  
  add_update(X, K, D, W, T, V1, S0) ->
    Ko = lists:keysort(1, K),
    Do = lists:keysort(1, D),
    case ets:lookup(S0#state.data, {X,Ko,Do}) of
      [] ->
        {reply, hang, S0};
      [{_, {calc, W} = V0}] ->
        io:format("Adding ~p ~p ~p = ~p~n", [X,Ko,Do,V1]),
        ets:insert(S0#state.data, {{X,Ko,Do}, V1}),
        S1 = S0#state{ck = S0#state.ck + 1},
        {reply, {V1, S1#state.ck}, S1};
      [{_, {calc, W1} = V0}] ->
        {reply, hang, S0};
      [O1,O2|Os] ->
        io:format("Multiple objects with the same key ~p ~p~n", [W, O1]),
        {reply, hang, S0};
      Other ->
        [{{X1,K1,D1},V1}] = Other,
        io:format("Other = ~p, W = ~p~n", [Other, W]),
        {reply, hang, S0}
    end.
  
negative.code: %%------------------------------------------------------------------------------
  %% Not implemented
  %%------------------------------------------------------------------------------
  code_change(_, _, _) ->
    not_implemented.
  
  handle_cast(_, _) ->
    not_implemented.
  
  