You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Invoker.java 660B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package controller;
  7. import java.util.HashMap;
  8. /**
  9. *
  10. * @author jechowma68968
  11. */
  12. public class Invoker
  13. {
  14. private HashMap<Object, Interface> commands;
  15. public Invoker()
  16. {
  17. commands = new HashMap<>();
  18. }
  19. /**
  20. *
  21. * @param key ist das Object
  22. * @param value ist auch etwas
  23. */
  24. public void addCommand(Object key, Interface value){
  25. commands.put(key, value);
  26. }
  27. public void executeCommand(Object key){
  28. commands.get(key).execute();
  29. }
  30. }