Skip to content
Snippets Groups Projects
Commit b57c5e85 authored by João Pereira's avatar João Pereira
Browse files

Update Instruction.java

parent 849c5bb2
No related branches found
No related tags found
2 merge requests!7Muz mutation,!5Matt branch
This commit is part of merge request !7. Comments created here will be created in the context of that merge request.
...@@ -53,4 +53,29 @@ public enum Instruction { ...@@ -53,4 +53,29 @@ public enum Instruction {
return "\"" + opcode + "\"" + operandsString; 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;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment