Merge remote-tracking branch 'origin/development' into development
[Mograsim.git] / plugins / net.mograsim.logic.model / src / net / mograsim / logic / model / snippets / highlevelstatehandlers / standard / subcomponent / SubcomponentHighLevelStateHandler.java
1 package net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.subcomponent;
2
3 import java.util.function.Consumer;
4
5 import com.google.gson.JsonElement;
6
7 import net.mograsim.logic.model.serializing.JSONSerializable;
8 import net.mograsim.logic.model.snippets.HighLevelStateHandler;
9
10 public interface SubcomponentHighLevelStateHandler extends JSONSerializable
11 {
12         /**
13          * Gets the current value of the given high level state of the subcomponent represented by this SubcomponentHighLevelStateHandler.<br>
14          * See {@link HighLevelStateHandler} for an explanation of high-level state IDs.
15          * 
16          * @author Daniel Kirschten
17          */
18         public Object getHighLevelState(String subStateID);
19
20         /**
21          * Sets the given high level state of the subcomponent represented by this SubcomponentHighLevelStateHandler to the given value.<br>
22          * See {@link HighLevelStateHandler} for an explanation of high-level state IDs.
23          * 
24          * @author Daniel Kirschten
25          */
26         public void setHighLevelState(String subStateID, Object newState);
27
28         public static class SubcomponentHighLevelStateHandlerParams
29         {
30                 public String id;
31                 public JsonElement params;
32         }
33
34         public void addListener(String subStateID, Consumer<Object> stateChanged);
35
36         public void removeListener(String subStateID, Consumer<Object> stateChanged);
37 }