1 package net.mograsim.logic.model.snippets.highlevelstatehandlers.standard;
3 import java.io.IOException;
4 import java.io.InputStream;
7 import net.mograsim.logic.model.snippets.CodeSnippetSupplier;
8 import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.atomic.AtomicHighLevelStateHandler;
9 import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.subcomponent.SubcomponentHighLevelStateHandler;
10 import net.mograsim.logic.model.util.JsonHandler;
12 public class StandardHighLevelStateHandlerSnippetSuppliers
14 public static final CodeSnippetSupplier<HighLevelStateHandlerContext, AtomicHighLevelStateHandler> atomicHandlerSupplier;
15 public static final CodeSnippetSupplier<HighLevelStateHandlerContext, SubcomponentHighLevelStateHandler> subcomponentHandlerSupplier;
19 atomicHandlerSupplier = new CodeSnippetSupplier<>(null);
20 subcomponentHandlerSupplier = new CodeSnippetSupplier<>(null);
25 // TODO update standardSnippetIDMapping.json
26 try (InputStream s = StandardHighLevelStateHandlerSnippetSuppliers.class.getResourceAsStream("./standardSnippetIDMapping.json"))
29 throw new IOException("Resource not found");
30 SnippetIDClassNames tmp = JsonHandler.readJson(s, SnippetIDClassNames.class);
31 tmp.standardSubcomponentHandlerSuppliers.forEach(subcomponentHandlerSupplier::addStandardSnippetID);
32 tmp.standardAtomicHandlerSuppliers.forEach(atomicHandlerSupplier::addStandardSnippetID);
36 System.err.println("Failed to initialize standard snippet ID mapping: ");
41 private static class SnippetIDClassNames
43 public Map<String, String> standardSubcomponentHandlerSuppliers;
44 public Map<String, String> standardAtomicHandlerSuppliers;
47 private StandardHighLevelStateHandlerSnippetSuppliers()
49 throw new UnsupportedOperationException();