Only BitDisplay now uses dashes instead of Z
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Sat, 12 Oct 2019 13:10:29 +0000 (15:10 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Sat, 12 Oct 2019 13:10:29 +0000 (15:10 +0200)
plugins/net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVectorFormatter.java
plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelBitDisplay.java
plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelFixedOutput.java
plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelManualSwitch.java
plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineRegister.java

index b24e342..8ffe07a 100644 (file)
@@ -9,9 +9,9 @@ import net.mograsim.preferences.Preferences;
 
 public class BitVectorFormatter
 {
-       public static String formatValueAsString(ReadEnd end)
+       public static String formatValueAsString(ReadEnd end, boolean useDashInsteadOfZ)
        {
-               return formatAsString(end == null ? null : end.getValues());
+               return formatAsString(end == null ? null : end.getValues(), useDashInsteadOfZ);
        }
 
        public static String toBitstring(BitVector bitVector)
@@ -19,7 +19,7 @@ public class BitVectorFormatter
                return bitVector.toBitstring();
        }
 
-       public static String formatAsString(BitVector bitVector)
+       public static String formatAsString(BitVector bitVector, boolean useDashInsteadOfZ)
        {
                if (bitVector == null)
                        return "null";
@@ -32,7 +32,7 @@ public class BitVectorFormatter
                        sb.append(hexdigits);
                        return sb.toString();
                }
-               if (bitVector.isHighImpedance())
+               if (useDashInsteadOfZ && bitVector.isHighImpedance())
                        return "-";
                return bitVector.toBitstring();
        }
index ac33266..1cf14e8 100644 (file)
@@ -55,7 +55,7 @@ public class ModelBitDisplay extends ModelComponent
                if (foreground != null)
                        gc.setForeground(foreground);
                gc.drawRectangle(getBounds());
-               String label = BitVectorFormatter.formatAsString(bitDisplay == null ? null : bitDisplay.getDisplayedValue());
+               String label = BitVectorFormatter.formatAsString(bitDisplay == null ? null : bitDisplay.getDisplayedValue(), true);
                Font oldFont = gc.getFont();
                Font labelFont = new Font(oldFont.getName(), fontHeight, oldFont.getStyle());
                gc.setFont(labelFont);
index 1d3bb1e..bdf6546 100644 (file)
@@ -58,7 +58,7 @@ public class ModelFixedOutput extends ModelComponent
                if (foreground != null)
                        gc.setForeground(foreground);
                gc.drawRectangle(getBounds());
-               String label = BitVectorFormatter.formatAsString(bits);
+               String label = BitVectorFormatter.formatAsString(bits, false);
                Font oldFont = gc.getFont();
                Font labelFont = new Font(oldFont.getName(), fontHeight, oldFont.getStyle());
                gc.setFont(labelFont);
index d4e0437..04d3b42 100644 (file)
@@ -142,7 +142,7 @@ public class ModelManualSwitch extends ModelComponent
                if (foreground != null)
                        gc.setForeground(foreground);
                gc.drawRectangle(getBounds());
-               String label = BitVectorFormatter.formatAsString(manualSwitch == null ? null : getOutValues());
+               String label = BitVectorFormatter.formatAsString(manualSwitch == null ? null : getOutValues(), false);
                Font oldFont = gc.getFont();
                Font labelFont = new Font(oldFont.getName(), fontHeight, oldFont.getStyle());
                gc.setFont(labelFont);
index e470420..88c6ba7 100644 (file)
@@ -97,7 +97,7 @@ public class MachineRegister extends PlatformObject implements IRegister
 
        public String getValueString()
        {
-               return BitVectorFormatter.formatAsString(getMachine().getRegister(machineRegister));
+               return BitVectorFormatter.formatAsString(getMachine().getRegister(machineRegister), false);
        }
 
        @Override