public void StartDisplayTrigger(TriggerCommand triggerCommand)
        {
            if (composite != null)
            {
                throw new InvalidOperationException("Cannot start trigger: already inside a loop or trigger");
            }

            decorate  = (command) => new TriggerDecorator <TValue>(command);
            composite = new CompositeCommand <TValue>();
        }
        public void EndDisplayComposite()
        {
            if (composite == null)
            {
                throw new InvalidOperationException("Cannot complete loop or trigger: Not inside one");
            }

            if (composite.HasCommands)
            {
                value.Add(decorate(composite));
            }

            composite = null;
            decorate  = null;
        }
        public void StartDisplayLoop(LoopCommand loopCommand)
        {
            if (composite != null)
            {
                throw new InvalidOperationException("Cannot start loop: already inside a loop or trigger");
            }

            decorate = (command) =>
            {
                if (loopCommand.CommandsStartTime != 0)
                {
                    throw new InvalidOperationException($"Commands in a loop must start at 0ms, but start at {loopCommand.CommandsStartTime}ms");
                }
                return(new LoopDecorator <TValue>(command, loopCommand.StartTime, loopCommand.CommandsDuration, loopCommand.LoopCount));
            };
            composite = new CompositeCommand <TValue>();
        }