Work on adding blankable fields

This commit is contained in:
Astatin3
2024-07-16 21:25:34 -06:00
parent 0dfddb7f89
commit 95c8dc45d3
13 changed files with 111 additions and 26 deletions
@@ -4,10 +4,11 @@ import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
public class ByteBuilder {
public static final int int_id = 0;
public static final int string_id = 1;
public static final int int_arr_id = 2;
public static final int string_arr_id = 3;
public static final int bool_id = 0;
public static final int int_id = 1;
public static final int string_id = 2;
public static final int int_arr_id = 3;
public static final int string_arr_id = 4;
ArrayList<byteType> bytesToBuild = new ArrayList<>();
@@ -24,6 +25,23 @@ public class ByteBuilder {
public abstract byte[] build();
}
private class boolType extends byteType {
public boolean val;
public byte getType(){return bool_id;}
public int length(){return 1;}
public byte[] build(){
return new byte[]{(byte) (val ? 1 : 0)};
}
}
public ByteBuilder addBool(boolean n) throws buildingException {
boolType boolType = new boolType();
boolType.val = n;
bytesToBuild.add(boolType);
return this;
}
private class intType extends byteType {
public int precision;
public int num;