MPROMEditor now calls its columns "Opcode" and "muPC"
[Mograsim.git] / plugins / net.mograsim.logic.model / src / net / mograsim / logic / model / snippets / HighLevelStateHandler.java
1 package net.mograsim.logic.model.snippets;
2
3 import java.util.function.Consumer;
4
5 import net.mograsim.logic.model.model.components.ModelComponent;
6 import net.mograsim.logic.model.serializing.JSONSerializable;
7
8 /**
9  * A high level state ID consists of parts separated by dots ('.').<br>
10  * The last part (the part after the last dot) is called "atomic high level state ID". The parts before that part are called "subcomponent
11  * ID"s.<br>
12  * If there is no dot in a high level state ID, the whole high level state ID is called atomic.<br>
13  * Note that subcomponent IDs don't have to correspond to actual subcomponents. For example, a RAM component may supply subcomponent IDs
14  * "c0000", "c0001" ... "cFFFF" without actually having a subcomponent for each cell. It also is allowed to delegate an atomic high level
15  * state ID to a subcomponent.
16  * 
17  * @author Daniel Kirschten
18  */
19 public interface HighLevelStateHandler extends JSONSerializable
20 {
21         /**
22          * Gets the current value of the given high-level state. <br>
23          * See {@link HighLevelStateHandler} for an explanation of high-level state IDs.
24          * 
25          * @see #set(String, Object)
26          * @see ModelComponent#getHighLevelState(String)
27          * 
28          * @author Daniel Kirschten
29          */
30         public Object get(String stateID);
31
32         /**
33          * Sets the given high-level state to the given value. <br>
34          * See {@link HighLevelStateHandler} for an explanation of high-level state IDs.
35          * 
36          * @see #get(String)
37          * @see ModelComponent#setHighLevelState(String, Object)
38          * 
39          * @author Daniel Kirschten
40          */
41         public void set(String stateID, Object newState);
42
43         public void addListener(String stateID, Consumer<Object> stateChanged);
44
45         public void removeListener(String stateID, Consumer<Object> stateChanged);
46 }