X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fserializing%2FIdentifierGetter.java;fp=net.mograsim.logic.model%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fserializing%2FIdentifierGetter.java;h=f1bb5f0b7f6861728471d013134e40873f0079d3;hb=3977f16649531ca3ba345c9cd5ec365e0b804783;hp=0000000000000000000000000000000000000000;hpb=13e5f7aac4b3584b0f4b70c7894fb1667b22cb41;p=Mograsim.git diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/IdentifierGetter.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/IdentifierGetter.java new file mode 100644 index 00000000..f1bb5f0b --- /dev/null +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/IdentifierGetter.java @@ -0,0 +1,36 @@ +package net.mograsim.logic.model.serializing; + +import java.util.function.Function; + +import net.mograsim.logic.model.model.components.GUIComponent; +import net.mograsim.logic.model.snippets.HighLevelStateHandler; +import net.mograsim.logic.model.snippets.Renderer; +import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.atomic.AtomicHighLevelStateHandler; +import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.subcomponent.SubcomponentHighLevelStateHandler; + +//TODO better name +public class IdentifierGetter +{ + // TODO save IDs for everything than can be deserialized / serialized (=every JSONSerializable?) + public Function componentIDs; + public Function symbolRendererIDs; + public Function outlineRendererIDs; + public Function highLevelStateHandlerIDs; + public Function subcomponentHighLevelStateHandlerIDs; + public Function atomicHighLevelStateHandlerIDs; + + /** + * Creates a new IdentifierGetter using "class:" concatenated with a component's / snippet's complete (canonical) class name as the + * default for all ID getter functions. + */ + public IdentifierGetter() + { + Function defaultSnippetIDGetter = c -> "class:" + c.getClass().getCanonicalName(); + this.componentIDs = defaultSnippetIDGetter::apply; + this.symbolRendererIDs = defaultSnippetIDGetter::apply; + this.outlineRendererIDs = defaultSnippetIDGetter::apply; + this.highLevelStateHandlerIDs = defaultSnippetIDGetter::apply; + this.subcomponentHighLevelStateHandlerIDs = defaultSnippetIDGetter::apply; + this.atomicHighLevelStateHandlerIDs = defaultSnippetIDGetter::apply; + } +} \ No newline at end of file