From faac09311668e9691235c3b354b4c497ecd8e902 Mon Sep 17 00:00:00 2001 From: Breval Ferrari Date: Tue, 13 May 2025 23:05:23 +0200 Subject: [PATCH] activity diagram for token application --- doc/uml/lib/token activity.puml | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 doc/uml/lib/token activity.puml diff --git a/doc/uml/lib/token activity.puml b/doc/uml/lib/token activity.puml new file mode 100644 index 0000000..526d2e9 --- /dev/null +++ b/doc/uml/lib/token activity.puml @@ -0,0 +1,44 @@ +@startuml "Token.apply activity diagram" +title Token.apply + +left footer +Les méthodes et champs de l'argument "context" et "self" ont été raccourcis pour gagner de la place. +"t" will be incremented by placing the length instruction in "slopes". Context.render will tick every slope variable at every frame. +endfooter + +start + +(C) +switch (T) +case (Silence) + :render(None); +case (Marser) + :result = []; +case (Note) + :render(n); +case (VariableChange) + :variables[name] = change.eval(variables); +case (Loop) + :old_context = context.clone(); + :context.result = []; + :new_context = fold inner into current context with Token.apply; + :return new_context.replace(result, old_context.result + new_context.result * count); +case (Tuplet) + :current_length = current_length(); + :calculate how many samples should fit in the current length; + :old_context = context.clone(); + :context.result = []; + :new_context = fold inner into current context with Token.apply; + :new_context.variables[t] = old_context.variables[t]; + :spray new_context.result with void until it fits the sample count; + :prepend old_context.result; + :return new context; +case (Slope) + :slopes += (each_frame.name, each_frame.change); + :context = fold inner into current context with Token.apply; + :slopes[each_frame.name].drop(); +endswitch + +stop + +@enduml \ No newline at end of file