def __add__(self, other): command = proto.LIST_COMMAND_NAME +\ proto.LIST_CONCAT_SUBCOMMAND_NAME +\ self._get_object_id() + "\n" + other._get_object_id() +\ "\n" + proto.END_COMMAND_PART answer = self._gateway_client.send_command(command) return get_return_value(answer, self._gateway_client)
def count(self, value): command = proto.LIST_COMMAND_NAME +\ proto.LIST_COUNT_SUBCOMMAND_NAME +\ self._get_object_id() + "\n" + get_command_part(value) +\ proto.END_COMMAND_PART answer = self._gateway_client.send_command(command) return get_return_value(answer, self._gateway_client)
def __len__(self): command = proto.ARRAY_COMMAND_NAME +\ proto.ARRAY_LEN_SUB_COMMAND_NAME +\ self._get_object_id() + "\n" command += proto.END_COMMAND_PART answer = self._gateway_client.send_command(command) return get_return_value(answer, self._gateway_client)
def _get_params(self, input): params = [] temp = smart_decode(input.readline())[:-1] while temp != proto.END: param = get_return_value("y" + temp, self.java_client) params.append(param) temp = smart_decode(input.readline())[:-1] return params
def __get_slice(self, indices): command = proto.LIST_COMMAND_NAME + proto.LIST_SLICE_SUBCOMMAND_NAME + \ self._get_object_id() + "\n" for index in indices: command += get_command_part(index) command += proto.END_COMMAND_PART answer = self._gateway_client.send_command(command) return get_return_value(answer, self._gateway_client)
def __compute_item(self, key): new_key = self.__compute_index(key) command = proto.ARRAY_COMMAND_NAME + proto.ARRAY_GET_SUB_COMMAND_NAME + \ self._get_object_id() + "\n" command += get_command_part(new_key) command += proto.END_COMMAND_PART answer = self._gateway_client.send_command(command) return get_return_value(answer, self._gateway_client)
def __get_slice(self, indices): command = proto.LIST_COMMAND_NAME +\ proto.LIST_SLICE_SUBCOMMAND_NAME +\ self._get_object_id() + "\n" for index in indices: command += get_command_part(index) command += proto.END_COMMAND_PART answer = self._gateway_client.send_command(command) return get_return_value(answer, self._gateway_client)
def __compute_item(self, key): new_key = self.__compute_index(key) command = proto.ARRAY_COMMAND_NAME +\ proto.ARRAY_GET_SUB_COMMAND_NAME +\ self._get_object_id() + "\n" command += get_command_part(new_key) command += proto.END_COMMAND_PART answer = self._gateway_client.send_command(command) return get_return_value(answer, self._gateway_client)
def __mul__(self, other): command = proto.LIST_COMMAND_NAME + proto.LIST_MULT_SUBCOMMAND_NAME + \ self._get_object_id() + "\n" + get_command_part(other) + \ proto.END_COMMAND_PART answer = self._gateway_client.send_command(command) return get_return_value(answer, self._gateway_client)
def __mul__(self, other): command = proto.LIST_COMMAND_NAME + proto.LIST_MULT_SUBCOMMAND_NAME +\ self._get_object_id() + "\n" + get_command_part(other) +\ proto.END_COMMAND_PART answer = self._gateway_client.send_command(command) return get_return_value(answer, self._gateway_client)