@Test public void testCount() { String inputCommand = ListCommand.LIST_COUNT_SUB_COMMAND_NAME + "\n" + target + "\ns1\ne\n"; list.add("1"); try { command.execute("l", new BufferedReader(new StringReader(inputCommand)), writer); assertEquals("!yi2\n", sWriter.toString()); } catch (Exception e) { e.printStackTrace(); fail(); } }
@Override public void execute(String commandName, BufferedReader reader, BufferedWriter writer) throws Py4JException, IOException { char subCommand = safeReadLine(reader).charAt(0); String returnCommand = null; if (subCommand == LIST_SLICE_SUB_COMMAND_NAME) { returnCommand = slice_list(reader); } else if (subCommand == LIST_CONCAT_SUB_COMMAND_NAME) { returnCommand = concat_list(reader); } else if (subCommand == LIST_MULT_SUB_COMMAND_NAME) { returnCommand = mult_list(reader); } else if (subCommand == LIST_IMULT_SUB_COMMAND_NAME) { returnCommand = imult_list(reader); } else if (subCommand == LIST_COUNT_SUB_COMMAND_NAME) { returnCommand = count_list(reader); } else { returnCommand = call_collections_method(reader, subCommand); } logger.finest("Returning command: " + returnCommand); writer.write(returnCommand); writer.flush(); }
ListCommand extends AbstractCommand { @Override public void execute(String commandName, BufferedReader reader, BufferedWriter writer) throws Py4JException, IOException { char subCommand = safeReadLine(reader).charAt(0); String returnCommand = null; if (subCommand == LIST_SLICE_SUB_COMMAND_NAME) { returnCommand = slice_list(reader); } else if (subCommand == LIST_CONCAT_SUB_COMMAND_NAME) { returnCommand = concat_list(reader); } else if (subCommand == LIST_MULT_SUB_COMMAND_NAME) { returnCommand = mult_list(reader); } else if (subCommand == LIST_IMULT_SUB_COMMAND_NAME) { returnCommand = imult_list(reader); } else if (subCommand == LIST_COUNT_SUB_COMMAND_NAME) { returnCommand = count_list(reader); } else { returnCommand = call_collections_method(reader, subCommand); } logger.finest("Returning command: " + returnCommand); writer.write(returnCommand); writer.flush(); } }
ListCommand extends AbstractCommand { @Override public void execute(String commandName, BufferedReader reader, BufferedWriter writer) throws Py4JException, IOException { char subCommand = safeReadLine(reader).charAt(0); String returnCommand = null; if (subCommand == LIST_SLICE_SUB_COMMAND_NAME) { returnCommand = slice_list(reader); } else if (subCommand == LIST_CONCAT_SUB_COMMAND_NAME) { returnCommand = concat_list(reader); } else if (subCommand == LIST_MULT_SUB_COMMAND_NAME) { returnCommand = mult_list(reader); } else if (subCommand == LIST_IMULT_SUB_COMMAND_NAME) { returnCommand = imult_list(reader); } else if (subCommand == LIST_COUNT_SUB_COMMAND_NAME) { returnCommand = count_list(reader); } else { returnCommand = call_collections_method(reader, subCommand); } logger.finest("Returning command: " + returnCommand); writer.write(returnCommand); writer.flush(); } ListCommand(); }
ListCommand extends AbstractCommand { @Override public void execute(String commandName, BufferedReader reader, BufferedWriter writer) throws Py4JException, IOException { char subCommand = safeReadLine(reader).charAt(0); String returnCommand = null; if (subCommand == LIST_SLICE_SUB_COMMAND_NAME) { returnCommand = slice_list(reader); } else if (subCommand == LIST_CONCAT_SUB_COMMAND_NAME) { returnCommand = concat_list(reader); } else if (subCommand == LIST_MULT_SUB_COMMAND_NAME) { returnCommand = mult_list(reader); } else if (subCommand == LIST_IMULT_SUB_COMMAND_NAME) { returnCommand = imult_list(reader); } else if (subCommand == LIST_COUNT_SUB_COMMAND_NAME) { returnCommand = count_list(reader); } else { returnCommand = call_collections_method(reader, subCommand); } logger.finest("Returning command: " + returnCommand); writer.write(returnCommand); writer.flush(); } ListCommand(); @Override void execute(String commandName, BufferedReader reader, BufferedWriter writer); }
ListCommand extends AbstractCommand { @Override public void execute(String commandName, BufferedReader reader, BufferedWriter writer) throws Py4JException, IOException { char subCommand = safeReadLine(reader).charAt(0); String returnCommand = null; if (subCommand == LIST_SLICE_SUB_COMMAND_NAME) { returnCommand = slice_list(reader); } else if (subCommand == LIST_CONCAT_SUB_COMMAND_NAME) { returnCommand = concat_list(reader); } else if (subCommand == LIST_MULT_SUB_COMMAND_NAME) { returnCommand = mult_list(reader); } else if (subCommand == LIST_IMULT_SUB_COMMAND_NAME) { returnCommand = imult_list(reader); } else if (subCommand == LIST_COUNT_SUB_COMMAND_NAME) { returnCommand = count_list(reader); } else { returnCommand = call_collections_method(reader, subCommand); } logger.finest("Returning command: " + returnCommand); writer.write(returnCommand); writer.flush(); } ListCommand(); @Override void execute(String commandName, BufferedReader reader, BufferedWriter writer); static final String LIST_COMMAND_NAME; static final char LIST_SORT_SUB_COMMAND_NAME; static final char LIST_REVERSE_SUB_COMMAND_NAME; static final char LIST_MAX_SUB_COMMAND_NAME; static final char LIST_MIN_SUB_COMMAND_NAME; static final char LIST_SLICE_SUB_COMMAND_NAME; static final char LIST_CONCAT_SUB_COMMAND_NAME; static final char LIST_MULT_SUB_COMMAND_NAME; static final char LIST_IMULT_SUB_COMMAND_NAME; static final char LIST_COUNT_SUB_COMMAND_NAME; static final String RETURN_VOID; }