Interfaces.java 1001 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 API;
  7. import ast.Node;
  8. import java.util.HashMap;
  9. /**
  10. *
  11. * @author Eugenio
  12. */
  13. public class Interfaces {
  14. /*Key: Nome da funcao, Val: Tipo da funcao */
  15. protected static HashMap<String, Node> interfaces;
  16. public static void _init() {
  17. System.out.println("Inicializando API.Interfaces");
  18. interfaces = new HashMap<>();
  19. }
  20. public static Node Get(String id) {
  21. return interfaces.get(id);
  22. }
  23. public static boolean Defined(String id) {
  24. return interfaces.containsKey(id);
  25. }
  26. public static void Add(String id, Node interfac) {
  27. interfac.Set("public", Base.IsPublic(id) ? "true" : "false");
  28. interfaces.put(id, interfac);
  29. }
  30. public static void List() {
  31. System.out.println("Interfaces:\n" + interfaces.keySet());
  32. }
  33. }