mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-10 21:38:05 -04:00
more consistent string conversion of high-z values, see #511
This commit is contained in:
parent
7c2d944856
commit
a526c91bc9
@ -66,7 +66,7 @@ public enum IntFormat {
|
||||
*/
|
||||
public String formatToEdit(Value inValue) {
|
||||
if (inValue.isHighZ())
|
||||
return "?";
|
||||
return "Z";
|
||||
|
||||
switch (this) {
|
||||
case dec:
|
||||
|
@ -49,7 +49,7 @@ public class InValue {
|
||||
* @throws Bits.NumberFormatException NumberFormatException
|
||||
*/
|
||||
public InValue(String value) throws Bits.NumberFormatException {
|
||||
if (value.toLowerCase().trim().equalsIgnoreCase("z")) {
|
||||
if (value.trim().equalsIgnoreCase("z")) {
|
||||
this.highZ = true;
|
||||
this.value = 0;
|
||||
} else {
|
||||
|
@ -236,7 +236,7 @@ public final class SingleValueDialog extends JDialog implements ModelStateObserv
|
||||
textField.setText("0" + Long.toOctalString(editValue));
|
||||
break;
|
||||
case HIGHZ:
|
||||
textField.setText("?");
|
||||
textField.setText("Z");
|
||||
break;
|
||||
default:
|
||||
}
|
||||
@ -267,7 +267,7 @@ public final class SingleValueDialog extends JDialog implements ModelStateObserv
|
||||
private void setStringToDialog(String text) {
|
||||
text = text.trim();
|
||||
if (text.length() > 0) {
|
||||
if (text.contains("?") && supportsHighZ) {
|
||||
if (text.contains("Z") && supportsHighZ) {
|
||||
setSelectedFormat(InMode.HIGHZ);
|
||||
editValue = 0;
|
||||
} else if (text.charAt(0) == '\'') {
|
||||
|
@ -20,6 +20,6 @@ public class ValueTest extends TestCase {
|
||||
public void testFromInValue() throws Bits.NumberFormatException {
|
||||
assertEquals("5", new Value(new InValue("5"), 4).toString());
|
||||
assertEquals("Z", new Value(new InValue("z"), 4).toString());
|
||||
assertEquals("?", IntFormat.hex.formatToEdit(new Value(new InValue("z"), 4)));
|
||||
assertEquals("Z", IntFormat.hex.formatToEdit(new Value(new InValue("z"), 4)));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user