package commands;

import java.util.ArrayList;
import java.util.List;

import timeline.Output;
import application.CommandObserver;

public class ObservableCommand {
    private Command command;
    private List<CommandObserver> observers = new ArrayList<>();

    public ObservableCommand(Command command) {
        this.command = command;
    }

    public Output executeCommand(CommandParameter commandParameter) {
        Output output = command.executeCommand(commandParameter);
        observers.stream().forEach(observer -> observer.update(output));
        return output;
    }

    public void registerObserver(CommandObserver observer) {
        observers.add(observer);
    }

    public boolean isApplicable(CommandParameter parameter) {
        return command.isApplicable(parameter);
    }

}
@@ -156,18 +156,37 @@
 Command 
+implements Command 
 %7B%0A
-
     priv
@@ -351,32 +351,147 @@
 command;%0A    %7D%0A%0A
+    public void registerObserver(CommandObserver observer) %7B%0A        observers.add(observer);%0A    %7D%0A%0A    @Override%0A
     public Outpu
@@ -721,104 +721,17 @@
     
-public void registerObserver(CommandObserver observer) %7B%0A        observers.add(observer);%0A    %7D%0A
+@Override
 %0A   

make ObservableCommand implement Command