1 package net.mograsim.logic.model.snippets;
3 import java.util.function.Consumer;
5 import net.mograsim.logic.model.model.components.ModelComponent;
6 import net.mograsim.logic.model.serializing.JSONSerializable;
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
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.
17 * @author Daniel Kirschten
19 public interface HighLevelStateHandler extends JSONSerializable
22 * Gets the current value of the given high-level state. <br>
23 * See {@link HighLevelStateHandler} for an explanation of high-level state IDs.
25 * @see #set(String, Object)
26 * @see ModelComponent#getHighLevelState(String)
28 * @author Daniel Kirschten
30 public Object get(String stateID);
33 * Sets the given high-level state to the given value. <br>
34 * See {@link HighLevelStateHandler} for an explanation of high-level state IDs.
37 * @see ModelComponent#setHighLevelState(String, Object)
39 * @author Daniel Kirschten
41 public void set(String stateID, Object newState);
43 public void addListener(String stateID, Consumer<Object> stateChanged);
45 public void removeListener(String stateID, Consumer<Object> stateChanged);