def binarySearchText(self, msgid_text): text_block = TextBlock(self) text_block.init() text_block.msgid.setText(msgid_text) found_item = Algo.binarySearch(self.block_list, text_block, cmp=self.compareMSGID) return found_item
def isIn(self, msgid_entry: TextBlock): if (self.is_sorted): found_index = Algo.isIn(self.block_list, msgid_entry, cmp=self.compareMSGID) is_found = (found_index >= 0) return is_found else: is_found = (msgid_entry in self.block_list) return is_found
def run(self): to_block = Algo.binarySearch(self.search_list, self.from_block, cmp=self.compareMSGID) is_found = (to_block != None) if (not is_found): return None else: print("ID:{}\nfind\n[{}]\nfound\n[{}]".format( self.threadID, self.name, to_block)) self.transferMSGSTR.setArgs(self.from_block, to_block) self.transferMSGSTR.run()
def binarySearchMSGID(self, msgid_entry: TextBlock): found_item = Algo.binarySearch(self.block_list, msgid_entry, cmp=self.compareMSGID) return found_item