Skip to content
Snippets Groups Projects

Muz mutation

1 file
+ 28
3
Compare changes
  • Side-by-side
  • Inline
+ 28
3
@@ -28,7 +28,7 @@ public enum Instruction {
}
return grammar;
}
private final String opcode;
private final OperandType[] operands;
@@ -40,7 +40,7 @@ public enum Instruction {
public String getOpcode(){
return opcode;
}
public OperandType[] getOperands(){
return operands;
}
@@ -52,5 +52,30 @@ public enum Instruction {
}
return "\"" + opcode + "\"" + operandsString;
}
public Instruction fromStringToInstruction(String input) {
int end_command = input.indexOf(" ");
String command = "";
if (end_command != -1) {
command += input.substring(0, end_command);
}
if (command == "put") {
return Instruction.PUT;
} else if (command == "get") {
return Instruction.GET;
} else if (command == "rem") {
return Instruction.REM;
} else if (command == "save") {
return Instruction.SAVE;
} else if (command == "list") {
return Instruction.LIST;
} else if (command == "masterpw") {
return Instruction.MASTERPW;
}
return null;
}
}
Loading