public List<ICommand> getAllCommands() { List<ICommand> commands = new ArrayList<>(); for (Map.Entry<String, CommandTagListMap> entry : historyWorksheetMap.entrySet()) { commands.addAll(entry.getValue().getCommands()); } return commands; }
public List<ICommand> getCommandsFromWorksheetIdAndCommandTag(String worksheetId, ICommand.CommandTag commandTag) { List<ICommand> commands = new ArrayList<>(); if (worksheetId == null) { worksheetId = IMPORT_COMMANDS; } CommandTagListMap map = historyWorksheetMap.get(worksheetId); if (map != null) { commands.addAll(map.getCommands(commandTag)); } return commands; }
public List<ICommand> getCommandsFromWorksheetId(String worksheetId) { List<ICommand> commands = new ArrayList<>(); if (worksheetId == null) { worksheetId = IMPORT_COMMANDS; } CommandTagListMap map = historyWorksheetMap.get(worksheetId); if (map != null) { commands.addAll(map.getCommands()); } return commands; }
public List<ICommand> getCommandsAfterCommand(ICommand command, ICommand.CommandTag commandTag) { List<ICommand> commands = new ArrayList<>(); String worksheetId = getWorksheetId(command); if (worksheetId == null) { worksheetId = IMPORT_COMMANDS; } CommandTagListMap map = historyWorksheetMap.get(worksheetId); if (map != null) { List<ICommand> tagCommands = map.getCommands(commandTag); boolean start = false; for(ICommand cmd : tagCommands) { if(cmd.equals(command)) { start = true; continue; } if(start) commands.add(cmd); } commands.addAll(map.getCommands(commandTag)); } return commands; }