mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-18 09:24:42 -04:00
makes also the switches countable
This commit is contained in:
parent
383b15dc06
commit
b17bc3b5ea
@ -114,4 +114,11 @@ public final class PlainSwitchDT implements NodeInterface {
|
||||
void addOutputsTo(ObservableValues.Builder ov) {
|
||||
ov.add(outputA, outputB, outputC);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the number of bits switched
|
||||
*/
|
||||
public int getBits() {
|
||||
return bits;
|
||||
}
|
||||
}
|
||||
|
@ -10,13 +10,14 @@ import de.neemann.digital.core.element.Element;
|
||||
import de.neemann.digital.core.element.ElementAttributes;
|
||||
import de.neemann.digital.core.element.ElementTypeDescription;
|
||||
import de.neemann.digital.core.element.Keys;
|
||||
import de.neemann.digital.core.stats.Countable;
|
||||
|
||||
import static de.neemann.digital.core.element.PinInfo.input;
|
||||
|
||||
/**
|
||||
* A simple relay.
|
||||
*/
|
||||
public class Relay extends Node implements Element {
|
||||
public class Relay extends Node implements Element, Countable {
|
||||
|
||||
/**
|
||||
* The relays description
|
||||
@ -79,4 +80,14 @@ public class Relay extends Node implements Element {
|
||||
public boolean isClosed() {
|
||||
return s.isClosed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataBits() {
|
||||
return s.getDataBits();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInputsCount() {
|
||||
return s.getInputsCount();
|
||||
}
|
||||
}
|
||||
|
@ -10,13 +10,14 @@ import de.neemann.digital.core.element.Element;
|
||||
import de.neemann.digital.core.element.ElementAttributes;
|
||||
import de.neemann.digital.core.element.ElementTypeDescription;
|
||||
import de.neemann.digital.core.element.Keys;
|
||||
import de.neemann.digital.core.stats.Countable;
|
||||
|
||||
import static de.neemann.digital.core.element.PinInfo.input;
|
||||
|
||||
/**
|
||||
* A simple relay.
|
||||
*/
|
||||
public class RelayDT extends Node implements Element {
|
||||
public class RelayDT extends Node implements Element, Countable {
|
||||
|
||||
/**
|
||||
* The relays description
|
||||
@ -76,4 +77,14 @@ public class RelayDT extends Node implements Element {
|
||||
public boolean isClosed() {
|
||||
return s.isClosed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataBits() {
|
||||
return s.getDataBits();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInputsCount() {
|
||||
return s.getInputsCount();
|
||||
}
|
||||
}
|
||||
|
@ -10,11 +10,12 @@ import de.neemann.digital.core.element.Element;
|
||||
import de.neemann.digital.core.element.ElementAttributes;
|
||||
import de.neemann.digital.core.element.ElementTypeDescription;
|
||||
import de.neemann.digital.core.element.Keys;
|
||||
import de.neemann.digital.core.stats.Countable;
|
||||
|
||||
/**
|
||||
* A simple manually controlled switch
|
||||
*/
|
||||
public class Switch implements Element, NodeInterface {
|
||||
public class Switch implements Element, NodeInterface, Countable {
|
||||
|
||||
/**
|
||||
* The switch description
|
||||
@ -103,4 +104,14 @@ public class Switch implements Element, NodeInterface {
|
||||
public boolean isClosed() {
|
||||
return closed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataBits() {
|
||||
return poles[0].getBits();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInputsCount() {
|
||||
return poles.length;
|
||||
}
|
||||
}
|
||||
|
@ -10,11 +10,12 @@ import de.neemann.digital.core.element.Element;
|
||||
import de.neemann.digital.core.element.ElementAttributes;
|
||||
import de.neemann.digital.core.element.ElementTypeDescription;
|
||||
import de.neemann.digital.core.element.Keys;
|
||||
import de.neemann.digital.core.stats.Countable;
|
||||
|
||||
/**
|
||||
* A simple double throw switch
|
||||
*/
|
||||
public class SwitchDT implements Element, NodeInterface {
|
||||
public class SwitchDT implements Element, NodeInterface, Countable {
|
||||
|
||||
/**
|
||||
* The switch description
|
||||
@ -91,4 +92,14 @@ public class SwitchDT implements Element, NodeInterface {
|
||||
public boolean isClosed() {
|
||||
return closed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataBits() {
|
||||
return poles[0].getBits();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInputsCount() {
|
||||
return poles.length;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user