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 try (InputStream s = StandardHighLevelStateHandlerSnippetSuppliers.class.getResourceAsStream("standardSnippetIDMapping.json"))
28 throw new IOException("Resource not found");
29 SnippetIDClassNames tmp = JsonHandler.readJson(s, SnippetIDClassNames.class);
30 tmp.standardSubcomponentHandlerSuppliers.forEach(subcomponentHandlerSupplier::addStandardSnippetID);
31 tmp.standardAtomicHandlerSuppliers.forEach(atomicHandlerSupplier::addStandardSnippetID);
35 System.err.println("Failed to initialize standard snippet ID mapping: ");
40 private static class SnippetIDClassNames
42 public Map<String, String> standardSubcomponentHandlerSuppliers;
43 public Map<String, String> standardAtomicHandlerSuppliers;
46 private StandardHighLevelStateHandlerSnippetSuppliers()
48 throw new UnsupportedOperationException();