added some documentation

This commit is contained in:
hneemann 2017-03-06 08:03:34 +01:00
parent 2dcebd49b7
commit 8180fa3990
2 changed files with 685 additions and 634 deletions

File diff suppressed because it is too large Load Diff

View File

@ -15,8 +15,8 @@ import java.util.HashSet;
*/
public final class BusModelStateObserver implements ModelStateObserver {
private final ArrayList<AbstractBusHandler> busList;
private final HashSet<Switch.RealSwitch> closedSwitches;
private int version;
private HashSet<Switch.RealSwitch> closedSwitches;
BusModelStateObserver() {
busList = new ArrayList<>();
@ -68,6 +68,12 @@ public final class BusModelStateObserver implements ModelStateObserver {
reconfigureNets();
}
/**
* Reconfiguration of the nets.
* If a switch is closed the nets on both contacts of the switch are connected to a single
* common net, After that the state of the new merged nets are updated.
* Needs to be called every time a switch has changed.
*/
private void reconfigureNets() {
busList.removeIf(abstractBusHandler -> abstractBusHandler instanceof ConnectedBusHandler);
HashMap<CommonBusValue, ConnectedBusHandler> netMap = new HashMap<>();