mirror of
https://github.com/hneemann/Digital.git
synced 2025-10-02 17:31:46 -04:00
added some debug infos to the switches
This commit is contained in:
parent
a224576668
commit
85f18defaa
@ -8,11 +8,14 @@ import de.neemann.digital.core.element.Keys;
|
|||||||
import de.neemann.digital.core.wiring.bus.BusModelStateObserver;
|
import de.neemann.digital.core.wiring.bus.BusModelStateObserver;
|
||||||
import de.neemann.digital.core.wiring.bus.CommonBusValue;
|
import de.neemann.digital.core.wiring.bus.CommonBusValue;
|
||||||
import de.neemann.digital.lang.Lang;
|
import de.neemann.digital.lang.Lang;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple switch
|
* A simple switch
|
||||||
*/
|
*/
|
||||||
public class Switch implements Element, NodeInterface {
|
public class Switch implements Element, NodeInterface {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(Switch.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The switch description
|
* The switch description
|
||||||
@ -29,6 +32,9 @@ public class Switch implements Element, NodeInterface {
|
|||||||
private boolean closed;
|
private boolean closed;
|
||||||
private SwitchModel switchModel;
|
private SwitchModel switchModel;
|
||||||
|
|
||||||
|
private static int debugSwitchReal;
|
||||||
|
private static int debugSwitchSimple;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance
|
* Creates a new instance
|
||||||
*
|
*
|
||||||
@ -83,6 +89,9 @@ public class Switch implements Element, NodeInterface {
|
|||||||
throw new NodeException(Lang.get("err_switchHasNoNet"), output1, output2);
|
throw new NodeException(Lang.get("err_switchHasNoNet"), output1, output2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (switchModel instanceof RealSwitch) debugSwitchReal++;
|
||||||
|
else debugSwitchSimple++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -99,6 +108,12 @@ public class Switch implements Element, NodeInterface {
|
|||||||
switchModel.setModel(model);
|
switchModel.setModel(model);
|
||||||
switchModel.setClosed(closed);
|
switchModel.setClosed(closed);
|
||||||
hasChanged();
|
hasChanged();
|
||||||
|
|
||||||
|
if (debugSwitchSimple != 0 || debugSwitchReal != 0) {
|
||||||
|
LOGGER.debug(debugSwitchSimple + " simple and " + debugSwitchReal + " real switches created");
|
||||||
|
debugSwitchSimple = 0;
|
||||||
|
debugSwitchReal = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user