In Java I have following class
public class Instruction {
public static Instruction label(String name) {
return new Instruction(Kind.label, name, null, 0);
}
public static Instruction literal(int value) {
return new Instruction(Kind.intLiteral, null, null, value);
}
public static Instruction literal(boolean value) {
return new Instruction(Kind.boolLiteral, null, null, value ? 1 : 0);
}
public static Instruction command(String name) {
return new Instruction(Kind.command, name, null, 0);
}
public static Instruction jump(String target) {
return new Instruction(Kind.jump, target, null, 0);
}
public static Instruction branch(String ifTarget, String elseTarget) {
return new Instruction(Kind.branch, ifTarget, elseTarget, 0);
}
private final Kind kind;
private final String s1;
private final String s2;
private final int value;
private Instruction(Kind kind, String s1, String s2, int value) {
this.kind = kind;
this.s1 = s1;
this.s2 = s2;
this.value = value;
}
...
}
How this should be done with Kotlin?