whitespace and comment refactoring

This patch replaces tabs with spaces and converts the '%' inline
comments (which according to the emacs mode are actually end of line
comments) to the mode acceptable '%%' inline comments.

Signed-off-by: Jordan Wilberding <diginux@gmail.com>
This commit is contained in:
Eric Merritt 2011-10-27 09:56:22 -05:00 committed by Jordan Wilberding
parent 960548301e
commit 8353035a1e
7 changed files with 182 additions and 182 deletions

View file

@ -13,16 +13,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]).
@ -30,7 +30,7 @@
%%% Types %%% Types
%%%=================================================================== %%%===================================================================
-opaque dictionary(K, V) :: {ec_assoc_list, -opaque dictionary(K, V) :: {ec_assoc_list,
[{ec_dictionary:key(K), ec_dictionary:value(V)}]}. [{ec_dictionary:key(K), ec_dictionary:value(V)}]}.
%%%=================================================================== %%%===================================================================
%%% API %%% API
@ -48,26 +48,26 @@ has_key(Key, {ec_assoc_list, Data}) ->
ec_dictionary:value(V). ec_dictionary:value(V).
get(Key, {ec_assoc_list, Data}) -> get(Key, {ec_assoc_list, Data}) ->
case lists:keyfind(Key, 1, Data) of case lists:keyfind(Key, 1, Data) of
{Key, Value} -> {Key, Value} ->
Value; Value;
false -> false ->
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, {ec_assoc_list, Data}) -> get(Key, Default, {ec_assoc_list, Data}) ->
case lists:keyfind(Key, 1, Data) of case lists:keyfind(Key, 1, Data) of
{Key, Value} -> {Key, Value} ->
Value; Value;
false -> false ->
Default Default
end. end.
-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, {ec_assoc_list, _Data}=Dict) -> add(Key, Value, {ec_assoc_list, _Data}=Dict) ->
{ec_assoc_list, Rest} = remove(Key,Dict), {ec_assoc_list, Rest} = remove(Key,Dict),
@ -87,7 +87,7 @@ size({ec_assoc_list, Data}) ->
length(Data). length(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({ec_assoc_list, Data}) -> to_list({ec_assoc_list, Data}) ->
Data. Data.
@ -99,5 +99,5 @@ from_list(List) when is_list(List) ->
-spec keys(dictionary(K, _V)) -> [ec_dictionary:key(K)]. -spec keys(dictionary(K, _V)) -> [ec_dictionary:key(K)].
keys({ec_assoc_list, Data}) -> keys({ec_assoc_list, Data}) ->
lists:map(fun({Key, _Value}) -> lists:map(fun({Key, _Value}) ->
Key Key
end, Data). end, Data).

View file

@ -15,16 +15,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]).
@ -49,26 +49,26 @@ has_key(Key, Data) ->
ec_dictionary:value(V). ec_dictionary:value(V).
get(Key, Data) -> get(Key, Data) ->
case dict:find(Key, Data) of case dict:find(Key, Data) of
{ok, Value} -> {ok, Value} ->
Value; Value;
error -> error ->
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 dict:find(Key, Data) of case dict:find(Key, Data) of
{ok, Value} -> {ok, Value} ->
Value; Value;
error -> error ->
Default Default
end. end.
-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) ->
dict:store(Key, Value, Data). dict:store(Key, Value, Data).
@ -81,19 +81,19 @@ remove(Key, Data) ->
-spec has_value(ec_dictionary:value(V), Object::dictionary(_K, V)) -> boolean(). -spec has_value(ec_dictionary:value(V), Object::dictionary(_K, V)) -> boolean().
has_value(Value, Data) -> has_value(Value, Data) ->
dict:fold(fun(_, NValue, _) when NValue == Value -> dict:fold(fun(_, NValue, _) when NValue == Value ->
true; true;
(_, _, Acc) -> (_, _, Acc) ->
Acc Acc
end, end,
false, false,
Data). Data).
-spec size(Object::dictionary(_K, _V)) -> integer(). -spec size(Object::dictionary(_K, _V)) -> integer().
size(Data) -> size(Data) ->
dict:size(Data). dict: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) ->
dict:to_list(Data). dict:to_list(Data).

View file

@ -15,28 +15,28 @@
%% API %% API
-export([new/1, -export([new/1,
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/2, from_list/2,
keys/1]). keys/1]).
-export_type([dictionary/2, -export_type([dictionary/2,
key/1, key/1,
value/1]). value/1]).
%%%=================================================================== %%%===================================================================
%%% Types %%% Types
%%%=================================================================== %%%===================================================================
-record(dict_t, -record(dict_t,
{callback, {callback,
data}). data}).
-opaque dictionary(_K, _V) :: #dict_t{}. -opaque dictionary(_K, _V) :: #dict_t{}.
-type key(T) :: T. -type key(T) :: T.

View file

@ -123,10 +123,10 @@ mkdtemp() ->
%% @doc Makes a directory including parent dirs if they are missing. %% @doc Makes a directory including parent dirs if they are missing.
-spec mkdir_path(path()) -> ok. -spec mkdir_path(path()) -> ok.
mkdir_path(Path) -> mkdir_path(Path) ->
% We are exploiting a feature of ensuredir that that creates all %% We are exploiting a feature of ensuredir that that creates all
% directories up to the last element in the filename, then ignores %% directories up to the last element in the filename, then ignores
% that last element. This way we ensure that the dir is created %% that last element. This way we ensure that the dir is created
% and not have any worries about path names %% and not have any worries about path names
DirName = filename:join([filename:absname(Path), "tmp"]), DirName = filename:join([filename:absname(Path), "tmp"]),
try try
ok = filelib:ensure_dir(DirName) ok = filelib:ensure_dir(DirName)
@ -343,7 +343,7 @@ setup_base_and_target() ->
{BaseDir, SourceDir, {Name1, Name2, Name3, NoName}}. {BaseDir, SourceDir, {Name1, Name2, Name3, NoName}}.
find_test() -> find_test() ->
% Create a directory in /tmp for the test. Clean everything afterwards %% Create a directory in /tmp for the test. Clean everything afterwards
{setup, {setup,
fun setup_base_and_target/0, fun setup_base_and_target/0,

View file

@ -15,16 +15,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]).
@ -49,26 +49,26 @@ has_key(Key, Data) ->
ec_dictionary:value(V). ec_dictionary:value(V).
get(Key, Data) -> get(Key, Data) ->
case orddict:find(Key, Data) of case orddict:find(Key, Data) of
{ok, Value} -> {ok, Value} ->
Value; Value;
error -> error ->
throw(not_found) throw(not_found)
end. end.
-spec get(ec_dictionary:key(K), -spec get(ec_dictionary:key(K),
Default::ec_dictionary:value(V), Default::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 orddict:find(Key, Data) of case orddict:find(Key, Data) of
{ok, Value} -> {ok, Value} ->
Value; Value;
error -> error ->
Default Default
end. end.
-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) ->
orddict:store(Key, Value, Data). orddict:store(Key, Value, Data).
@ -81,12 +81,12 @@ remove(Key, Data) ->
-spec has_value(ec_dictionary:value(V), Object::dictionary(_K, V)) -> boolean(). -spec has_value(ec_dictionary:value(V), Object::dictionary(_K, V)) -> boolean().
has_value(Value, Data) -> has_value(Value, Data) ->
orddict:fold(fun(_, NValue, _) when NValue == Value -> orddict:fold(fun(_, NValue, _) when NValue == Value ->
true; true;
(_, _, Acc) -> (_, _, Acc) ->
Acc Acc
end, end,
false, false,
Data). Data).
-spec size(Object::dictionary(_K, _V)) -> integer(). -spec size(Object::dictionary(_K, _V)) -> integer().
size(Data) -> size(Data) ->

View file

@ -111,9 +111,9 @@ map_gather([{Pid, _E} | Rest]) ->
receive receive
{Pid, {value, Ret}} -> {Pid, {value, Ret}} ->
[Ret|map_gather(Rest)]; [Ret|map_gather(Rest)];
% timeouts fall here too. Should timeouts be a return value %% timeouts fall here too. Should timeouts be a return value
% or an exception? I lean toward return value, but the code %% or an exception? I lean toward return value, but the code
% is easier with the exception. Thoughts? %% is easier with the exception. Thoughts?
{Pid, Exception} -> {Pid, Exception} ->
killall(Rest), killall(Rest),
throw(Exception) throw(Exception)
@ -153,9 +153,9 @@ do_f(Parent, F, E) ->
Parent ! {self(), {value, Result}} Parent ! {self(), {value, Result}}
catch catch
_Class:Exception -> _Class:Exception ->
% Losing class info here, but since throw does not accept %% Losing class info here, but since throw does not accept
% that arg anyhow and forces a class of throw it does not %% that arg anyhow and forces a class of throw it does not
% matter. %% matter.
Parent ! {self(), Exception} Parent ! {self(), Exception}
end. end.

View file

@ -60,8 +60,8 @@
%% Standard interface. %% Standard interface.
-export([add/3, from_list/1, get/2, get/3, has_key/2, -export([add/3, from_list/1, get/2, get/3, has_key/2,
has_value/2, new/0, remove/2, size/1, to_list/1, has_value/2, new/0, remove/2, size/1, to_list/1,
keys/1]). keys/1]).
-export_type([dictionary/2]). -export_type([dictionary/2]).
@ -70,10 +70,10 @@
%%%=================================================================== %%%===================================================================
-opaque dictionary(K, V) :: empty | {color(), -opaque dictionary(K, V) :: empty | {color(),
dictionary(K, V), dictionary(K, V),
ec_dictionary:key(K), ec_dictionary:key(K),
ec_dictionary:value(V), ec_dictionary:value(V),
dictionary(K, V)}. dictionary(K, V)}.
-type color() :: r | b. -type color() :: r | b.
@ -105,8 +105,8 @@ get(_, {_, _, _, Val, _}) ->
Val. Val.
-spec get(ec_dictionary:key(K), -spec get(ec_dictionary:key(K),
ec_dictionary:value(V), ec_dictionary:value(V),
dictionary(K, V)) -> ec_dictionary:value(V). dictionary(K, V)) -> ec_dictionary:value(V).
get(_, Default, empty) -> get(_, Default, empty) ->
Default; Default;
get(K, Default, {_, Left, K1, _, _}) when K < K1 -> get(K, Default, {_, Left, K1, _, _}) when K < K1 ->
@ -117,7 +117,7 @@ get(_, _, {_, _, _, Val, _}) ->
Val. Val.
-spec add(ec_dicitonary:key(K), ec_dictionary:value(V), -spec add(ec_dicitonary:key(K), ec_dictionary:value(V),
dictionary(K, V)) -> dictionary(K, V). dictionary(K, V)) -> dictionary(K, V).
add(Key, Value, Dict) -> add(Key, Value, Dict) ->
{_, L, K1, V1, R} = add1(Key, Value, Dict), {_, L, K1, V1, R} = add1(Key, Value, Dict),
{b, L, K1, V1, R}. {b, L, K1, V1, R}.
@ -129,9 +129,9 @@ remove(Key, Dictionary) ->
-spec has_value(ec_dictionary:value(V), dictionary(_K, V)) -> boolean(). -spec has_value(ec_dictionary:value(V), dictionary(_K, V)) -> boolean().
has_value(Value, Dict) -> has_value(Value, Dict) ->
fold(fun (_, NValue, _) when NValue == Value -> true; fold(fun (_, NValue, _) when NValue == Value -> true;
(_, _, Acc) -> Acc (_, _, Acc) -> Acc
end, end,
false, Dict). false, Dict).
-spec size(dictionary(_K, _V)) -> integer(). -spec size(dictionary(_K, _V)) -> integer().
size(T) -> size(T) ->
@ -146,9 +146,9 @@ to_list(T) ->
dictionary(K, V). dictionary(K, V).
from_list(L) -> from_list(L) ->
lists:foldl(fun ({K, V}, D) -> lists:foldl(fun ({K, V}, D) ->
add(K, V, D) add(K, V, D)
end, new(), end, new(),
L). L).
-spec keys(dictionary(K, _V)) -> [ec_dictionary:key(K)]. -spec keys(dictionary(K, _V)) -> [ec_dictionary:key(K)].
keys(Dict) -> keys(Dict) ->
@ -171,59 +171,59 @@ erase_aux(_, empty) ->
{empty, false}; {empty, false};
erase_aux(K, {b, A, Xk, Xv, B}) -> erase_aux(K, {b, A, Xk, Xv, B}) ->
if K < Xk -> if K < Xk ->
{A1, Dec} = erase_aux(K, A), {A1, Dec} = erase_aux(K, A),
if Dec -> if Dec ->
unbalright(b, A1, Xk, Xv, B); unbalright(b, A1, Xk, Xv, B);
true -> true ->
{{b, A1, Xk, Xv, B}, false} {{b, A1, Xk, Xv, B}, false}
end; end;
K > Xk -> K > Xk ->
{B1, Dec} = erase_aux(K, B), {B1, Dec} = erase_aux(K, B),
if Dec -> if Dec ->
unballeft(b, A, Xk, Xv, B1); unballeft(b, A, Xk, Xv, B1);
true -> true ->
{{b, A, Xk, Xv, B1}, false} {{b, A, Xk, Xv, B1}, false}
end; end;
true -> true ->
case B of case B of
empty -> empty ->
blackify(A); blackify(A);
_ -> _ ->
{B1, {Mk, Mv}, Dec} = erase_min(B), {B1, {Mk, Mv}, Dec} = erase_min(B),
if Dec -> if Dec ->
unballeft(b, A, Mk, Mv, B1); unballeft(b, A, Mk, Mv, B1);
true -> true ->
{{b, A, Mk, Mv, B1}, false} {{b, A, Mk, Mv, B1}, false}
end end
end end
end; end;
erase_aux(K, {r, A, Xk, Xv, B}) -> erase_aux(K, {r, A, Xk, Xv, B}) ->
if K < Xk -> if K < Xk ->
{A1, Dec} = erase_aux(K, A), {A1, Dec} = erase_aux(K, A),
if Dec -> if Dec ->
unbalright(r, A1, Xk, Xv, B); unbalright(r, A1, Xk, Xv, B);
true -> true ->
{{r, A1, Xk, Xv, B}, false} {{r, A1, Xk, Xv, B}, false}
end; end;
K > Xk -> K > Xk ->
{B1, Dec} = erase_aux(K, B), {B1, Dec} = erase_aux(K, B),
if Dec -> if Dec ->
unballeft(r, A, Xk, Xv, B1); unballeft(r, A, Xk, Xv, B1);
true -> true ->
{{r, A, Xk, Xv, B1}, false} {{r, A, Xk, Xv, B1}, false}
end; end;
true -> true ->
case B of case B of
empty -> empty ->
{A, false}; {A, false};
_ -> _ ->
{B1, {Mk, Mv}, Dec} = erase_min(B), {B1, {Mk, Mv}, Dec} = erase_min(B),
if Dec -> if Dec ->
unballeft(r, A, Mk, Mv, B1); unballeft(r, A, Mk, Mv, B1);
true -> true ->
{{r, A, Mk, Mv, B1}, false} {{r, A, Mk, Mv, B1}, false}
end end
end end
end. end.
-spec erase_min(dictionary(K, V)) -> -spec erase_min(dictionary(K, V)) ->
@ -239,15 +239,15 @@ erase_min({r, empty, Xk, Xv, A}) ->
erase_min({b, A, Xk, Xv, B}) -> erase_min({b, A, Xk, Xv, B}) ->
{A1, Min, Dec} = erase_min(A), {A1, Min, Dec} = erase_min(A),
if Dec -> if Dec ->
{T, Dec1} = unbalright(b, A1, Xk, Xv, B), {T, Dec1} = unbalright(b, A1, Xk, Xv, B),
{T, Min, Dec1}; {T, Min, Dec1};
true -> {{b, A1, Xk, Xv, B}, Min, false} true -> {{b, A1, Xk, Xv, B}, Min, false}
end; end;
erase_min({r, A, Xk, Xv, B}) -> erase_min({r, A, Xk, Xv, B}) ->
{A1, Min, Dec} = erase_min(A), {A1, Min, Dec} = erase_min(A),
if Dec -> if Dec ->
{T, Dec1} = unbalright(r, A1, Xk, Xv, B), {T, Dec1} = unbalright(r, A1, Xk, Xv, B),
{T, Min, Dec1}; {T, Min, Dec1};
true -> {{r, A1, Xk, Xv, B}, Min, false} true -> {{r, A1, Xk, Xv, B}, Min, false}
end. end.
@ -259,7 +259,7 @@ unballeft(r, {b, A, Xk, Xv, B}, Yk, Yv, C) ->
unballeft(b, {b, A, Xk, Xv, B}, Yk, Yv, C) -> unballeft(b, {b, A, Xk, Xv, B}, Yk, Yv, C) ->
{lbalance(b, {r, A, Xk, Xv, B}, Yk, Yv, C), true}; {lbalance(b, {r, A, Xk, Xv, B}, Yk, Yv, C), true};
unballeft(b, {r, A, Xk, Xv, {b, B, Yk, Yv, C}}, Zk, Zv, unballeft(b, {r, A, Xk, Xv, {b, B, Yk, Yv, C}}, Zk, Zv,
D) -> D) ->
{{b, A, Xk, Xv, {{b, A, Xk, Xv,
lbalance(b, {r, B, Yk, Yv, C}, Zk, Zv, D)}, lbalance(b, {r, B, Yk, Yv, C}, Zk, Zv, D)},
false}. false}.
@ -269,7 +269,7 @@ unbalright(r, A, Xk, Xv, {b, B, Yk, Yv, C}) ->
unbalright(b, A, Xk, Xv, {b, B, Yk, Yv, C}) -> unbalright(b, A, Xk, Xv, {b, B, Yk, Yv, C}) ->
{rbalance(b, A, Xk, Xv, {r, B, Yk, Yv, C}), true}; {rbalance(b, A, Xk, Xv, {r, B, Yk, Yv, C}), true};
unbalright(b, A, Xk, Xv, unbalright(b, A, Xk, Xv,
{r, {b, B, Yk, Yv, C}, Zk, Zv, D}) -> {r, {b, B, Yk, Yv, C}, Zk, Zv, D}) ->
{{b, rbalance(b, A, Xk, Xv, {r, B, Yk, Yv, C}), Zk, Zv, {{b, rbalance(b, A, Xk, Xv, {r, B, Yk, Yv, C}), Zk, Zv,
D}, D},
false}. false}.
@ -295,25 +295,25 @@ to_list({_, A, Xk, Xv, B}, List) ->
%% Balance a tree afer (possibly) adding a node to the left/right. %% Balance a tree afer (possibly) adding a node to the left/right.
-spec lbalance(color(), dictionary(K, V), -spec lbalance(color(), dictionary(K, V),
ec_dictinary:key(K), ec_dictionary:value(V), ec_dictinary:key(K), ec_dictionary:value(V),
dictionary(K, V)) -> dictionary(K, V)) ->
dictionary(K, V). dictionary(K, V).
lbalance(b, {r, {r, A, Xk, Xv, B}, Yk, Yv, C}, Zk, Zv, lbalance(b, {r, {r, A, Xk, Xv, B}, Yk, Yv, C}, Zk, Zv,
D) -> D) ->
{r, {b, A, Xk, Xv, B}, Yk, Yv, {b, C, Zk, Zv, D}}; {r, {b, A, Xk, Xv, B}, Yk, Yv, {b, C, Zk, Zv, D}};
lbalance(b, {r, A, Xk, Xv, {r, B, Yk, Yv, C}}, Zk, Zv, lbalance(b, {r, A, Xk, Xv, {r, B, Yk, Yv, C}}, Zk, Zv,
D) -> D) ->
{r, {b, A, Xk, Xv, B}, Yk, Yv, {b, C, Zk, Zv, D}}; {r, {b, A, Xk, Xv, B}, Yk, Yv, {b, C, Zk, Zv, D}};
lbalance(C, A, Xk, Xv, B) -> {C, A, Xk, Xv, B}. lbalance(C, A, Xk, Xv, B) -> {C, A, Xk, Xv, B}.
-spec rbalance(color(), dictionary(K, V), -spec rbalance(color(), dictionary(K, V),
ec_dictinary:key(K), ec_dictionary:value(V), ec_dictinary:key(K), ec_dictionary:value(V),
dictionary(K, V)) -> dictionary(K, V)) ->
dictionary(K, V). dictionary(K, V).
rbalance(b, A, Xk, Xv, rbalance(b, A, Xk, Xv,
{r, {r, B, Yk, Yv, C}, Zk, Zv, D}) -> {r, {r, B, Yk, Yv, C}, Zk, Zv, D}) ->
{r, {b, A, Xk, Xv, B}, Yk, Yv, {b, C, Zk, Zv, D}}; {r, {b, A, Xk, Xv, B}, Yk, Yv, {b, C, Zk, Zv, D}};
rbalance(b, A, Xk, Xv, rbalance(b, A, Xk, Xv,
{r, B, Yk, Yv, {r, C, Zk, Zv, D}}) -> {r, B, Yk, Yv, {r, C, Zk, Zv, D}}) ->
{r, {b, A, Xk, Xv, B}, Yk, Yv, {b, C, Zk, Zv, D}}; {r, {b, A, Xk, Xv, B}, Yk, Yv, {b, C, Zk, Zv, D}};
rbalance(C, A, Xk, Xv, B) -> {C, A, Xk, Xv, B}. rbalance(C, A, Xk, Xv, B) -> {C, A, Xk, Xv, B}.