mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 15:26:41 +00:00
parent
8c97db25f4
commit
3032aae3e4
@ -37,7 +37,8 @@ public class TVByte extends VSByte implements TrickViewFluent<TVByte.Format> {
|
|||||||
|
|
||||||
Binary {
|
Binary {
|
||||||
public String format(byte value, boolean unsigned) {
|
public String format(byte value, boolean unsigned) {
|
||||||
return Integer.toBinaryString(value & 0xFF);
|
String result = Integer.toBinaryString(value & 0xFF);
|
||||||
|
return "00000000".substring(result.length()) + result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte parse(String value) {
|
public byte parse(String value) {
|
||||||
|
@ -32,12 +32,14 @@ public class TVInteger extends VSInteger implements TrickViewFluent<TVInteger.Fo
|
|||||||
|
|
||||||
Decimal {
|
Decimal {
|
||||||
public String format(int value, boolean unsigned) {
|
public String format(int value, boolean unsigned) {
|
||||||
|
String result;
|
||||||
if (unsigned && value < 0) {
|
if (unsigned && value < 0) {
|
||||||
return Long.toString(value + 4294967296L);
|
result = Long.toString(value + 4294967296L);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Integer.toString(value);
|
result = Integer.toString(value);
|
||||||
}
|
}
|
||||||
|
return "00000000000000000000000000000000".substring(result.length()) + result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int parse(String value) {
|
public int parse(String value) {
|
||||||
|
@ -22,7 +22,9 @@ public class TVLong extends VSLong implements TrickViewFluent<TVLong.Format> {
|
|||||||
|
|
||||||
Binary {
|
Binary {
|
||||||
public String format(long value, boolean unsigned) {
|
public String format(long value, boolean unsigned) {
|
||||||
return Long.toBinaryString(value);
|
String result = Long.toBinaryString(value);
|
||||||
|
return "0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
.substring(result.length()) + result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long parse(String value) {
|
public long parse(String value) {
|
||||||
|
@ -22,7 +22,8 @@ public class TVShort extends VSShort implements TrickViewFluent<TVShort.Format>
|
|||||||
|
|
||||||
Binary {
|
Binary {
|
||||||
public String format(short value, boolean unsigned) {
|
public String format(short value, boolean unsigned) {
|
||||||
return Integer.toBinaryString(value & 0xFFFF);
|
String result = Integer.toBinaryString(value & 0xFFFF);
|
||||||
|
return "0000000000000000".substring(result.length()) + result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public short parse(String value) {
|
public short parse(String value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user