This commit is contained in:
hneemann 2024-04-20 10:07:55 +02:00
parent 468972d744
commit f7c58f2920
2 changed files with 13 additions and 10 deletions

View File

@ -159,7 +159,7 @@ public final class Signal implements Comparable<Signal> {
/** /**
* Returns true if this signal is a valid signal. * Returns true if this signal is a valid signal.
* Valid means there is a name and the value is non null * Valid means there is a name and the value is not null
* *
* @return true if signal is valid * @return true if signal is valid
*/ */

View File

@ -49,6 +49,7 @@ public class Out implements Element {
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.LED_SIZE) .addAttribute(Keys.LED_SIZE)
.addAttribute(Keys.ADD_VALUE_TO_GRAPH)
.addAttribute(Keys.COLOR); .addAttribute(Keys.COLOR);
/** /**
@ -56,9 +57,10 @@ public class Out implements Element {
*/ */
public static final ElementTypeDescription POLARITYAWARELEDDESCRIPTION public static final ElementTypeDescription POLARITYAWARELEDDESCRIPTION
= new ElementTypeDescription("PolarityAwareLED", = new ElementTypeDescription("PolarityAwareLED",
attributes -> new Out(1, 1), input("A"), input("C")) attributes -> new Out(attributes, 1, 1), input("A"), input("C"))
.addAttribute(Keys.ROTATE) .addAttribute(Keys.ROTATE)
.addAttribute(Keys.LABEL) .addAttribute(Keys.LABEL)
.addAttribute(Keys.ADD_VALUE_TO_GRAPH)
.addAttribute(Keys.COLOR); .addAttribute(Keys.COLOR);
/** /**
@ -71,7 +73,7 @@ public class Out implements Element {
*/ */
public static final ElementTypeDescription SEVENHEXDESCRIPTION public static final ElementTypeDescription SEVENHEXDESCRIPTION
= new ElementTypeDescription("Seven-Seg-Hex", = new ElementTypeDescription("Seven-Seg-Hex",
attributes -> new Out(4, 1), input("d"), input("dp")) attributes -> new Out(attributes, 4, 1), input("d"), input("dp"))
.addAttribute(Keys.COLOR) .addAttribute(Keys.COLOR)
.addAttribute(Keys.SEVEN_SEG_SIZE); .addAttribute(Keys.SEVEN_SEG_SIZE);
@ -80,7 +82,7 @@ public class Out implements Element {
*/ */
public static final ElementTypeDescription SIXTEENDESCRIPTION public static final ElementTypeDescription SIXTEENDESCRIPTION
= new ElementTypeDescription("SixteenSeg", = new ElementTypeDescription("SixteenSeg",
attributes -> new Out(16, 1), input("led"), input("dp")) attributes -> new Out(attributes, 16, 1), input("led"), input("dp"))
.addAttribute(Keys.COLOR) .addAttribute(Keys.COLOR)
.addAttribute(Keys.SEVEN_SEG_SIZE); .addAttribute(Keys.SEVEN_SEG_SIZE);
@ -108,14 +110,15 @@ public class Out implements Element {
/** /**
* Creates a new instance * Creates a new instance
* *
* @param bits the bitcount of the different inputs * @param attributes the attributes
* @param bits the bitcount of the different inputs
*/ */
public Out(int... bits) { public Out(ElementAttributes attributes, int... bits) {
this.bits = bits; this.bits = bits;
label = null; label = attributes.getLabel();
pinNumber = ""; pinNumber = "";
formatter = null; formatter = null;
showInGraph = true; showInGraph = attributes.get(Keys.ADD_VALUE_TO_GRAPH);
} }
@Override @Override
@ -151,9 +154,9 @@ public class Out implements Element {
private SevenSegTypeDescription() { private SevenSegTypeDescription() {
super("Seven-Seg", attributes -> { super("Seven-Seg", attributes -> {
if (attributes.get(Keys.COMMON_CONNECTION)) if (attributes.get(Keys.COMMON_CONNECTION))
return new Out(1, 1, 1, 1, 1, 1, 1, 1, 1); return new Out(attributes, 1, 1, 1, 1, 1, 1, 1, 1, 1);
else else
return new Out(1, 1, 1, 1, 1, 1, 1, 1); return new Out(attributes, 1, 1, 1, 1, 1, 1, 1, 1);
}); });
addAttribute(Keys.COLOR); addAttribute(Keys.COLOR);
addAttribute(Keys.COMMON_CONNECTION); addAttribute(Keys.COMMON_CONNECTION);