Search in sources :

Example 1 with Keyboard

use of com.cburch.logisim.std.io.Keyboard in project logisim-evolution by reds-heig.

the class TtyInterface method prepareForTty.

private static boolean prepareForTty(CircuitState circState, ArrayList<InstanceState> keybStates) {
    boolean found = false;
    for (Component comp : circState.getCircuit().getNonWires()) {
        Object factory = comp.getFactory();
        if (factory instanceof Tty) {
            Tty ttyFactory = (Tty) factory;
            InstanceState ttyState = circState.getInstanceState(comp);
            ttyFactory.sendToStdout(ttyState);
            found = true;
        } else if (factory instanceof Keyboard) {
            keybStates.add(circState.getInstanceState(comp));
            found = true;
        }
    }
    for (CircuitState sub : circState.getSubstates()) {
        found |= prepareForTty(sub, keybStates);
    }
    return found;
}
Also used : CircuitState(com.cburch.logisim.circuit.CircuitState) InstanceState(com.cburch.logisim.instance.InstanceState) Keyboard(com.cburch.logisim.std.io.Keyboard) Tty(com.cburch.logisim.std.io.Tty) Component(com.cburch.logisim.comp.Component)

Aggregations

CircuitState (com.cburch.logisim.circuit.CircuitState)1 Component (com.cburch.logisim.comp.Component)1 InstanceState (com.cburch.logisim.instance.InstanceState)1 Keyboard (com.cburch.logisim.std.io.Keyboard)1 Tty (com.cburch.logisim.std.io.Tty)1