7fd1fc96f7e3f3da4925acd6ea5ba51fe0855719
[Mograsim.git] /
1 package net.mograsim.logic.model.snippets.highlevelstatehandlers;
2
3 import net.mograsim.logic.model.model.components.submodels.SubmodelComponent;
4 import net.mograsim.logic.model.serializing.IdentifyParams;
5 import net.mograsim.logic.model.snippets.HighLevelStateHandler;
6 import net.mograsim.logic.model.snippets.SnippetDefinintion;
7 import net.mograsim.logic.model.snippets.SubmodelComponentSnippetSuppliers;
8
9 public class DefaultHighLevelStateHandler implements HighLevelStateHandler
10 {
11         public DefaultHighLevelStateHandler()
12         {
13                 this(null);
14         }
15
16         public DefaultHighLevelStateHandler(SubmodelComponent component)
17         {
18                 this(component, null);
19         }
20
21         @SuppressWarnings("unused") // we don't need the component; and params are always null
22         public DefaultHighLevelStateHandler(SubmodelComponent component, Void params)
23         {
24                 // nothing to do here
25         }
26
27         @Override
28         public Object getHighLevelState(String stateID)
29         {
30                 throw new IllegalArgumentException("No high level state with ID " + stateID);
31         }
32
33         @Override
34         public void setHighLevelState(String stateID, Object newState)
35         {
36                 throw new IllegalArgumentException("No high level state with ID " + stateID);
37         }
38
39         @Override
40         public String getIDForSerializing(IdentifyParams idParams)
41         {
42                 return "default";
43         }
44
45         @Override
46         public Void getParamsForSerializing(IdentifyParams idParams)
47         {
48                 return null;
49         }
50
51         static
52         {
53                 SubmodelComponentSnippetSuppliers.highLevelStateHandlerSupplier.setSnippetSupplier(
54                                 DefaultHighLevelStateHandler.class.getCanonicalName(),
55                                 SnippetDefinintion.create(Void.class, DefaultHighLevelStateHandler::new));
56         }
57 }