1 package org.simantics.interop.scl;
3 import java.util.HashMap;
6 import org.simantics.scl.runtime.function.Function;
7 import org.simantics.utils.datastructures.MapList;
9 @SuppressWarnings({"rawtypes","unchecked"})
10 public class FunctionRegistry {
13 static Map<Object, MapList<String, Function>> map = new HashMap<Object, MapList<String,Function>>();
15 public static void register(Object key, String name, Function f) {
16 MapList<String, Function> fmap = map.get(key);
18 fmap = new MapList<>();
24 public static void call0 (Object key, String name) {
25 MapList<String, Function> fmap = map.get(key);
28 for (Function f : fmap.getValues(name)) {
34 public static void call1 (Object key, String name, Object o1) {
35 MapList<String, Function> fmap = map.get(key);
38 for (Function f : fmap.getValues(name)) {
43 public static void call2 (Object key, String name, Object o1, Object o2) {
44 MapList<String, Function> fmap = map.get(key);
47 for (Function f : fmap.getValues(name)) {
52 public static void call3 (Object key, String name, Object o1, Object o2, Object o3) {
53 MapList<String, Function> fmap = map.get(key);
56 for (Function f : fmap.getValues(name)) {
61 public static void call4 (Object key, String name, Object o1, Object o2, Object o3, Object o4) {
62 MapList<String, Function> fmap = map.get(key);
65 for (Function f : fmap.getValues(name)) {
70 public static void clear(Object key) {
74 public static void clear(Object key, String name) {
75 MapList<String, Function> fmap = map.get(key);
81 public static void clear(Object key, String name,Function f) {
82 MapList<String, Function> fmap = map.get(key);