def get_file(self, fileName): fileValue = self.buffer.search_retNode(fileName) if(fileValue != None): if(type(fileValue) == str): fileValue = Meta.getMetaObject(fileValue) if fileValue != None: for value in self.buffer.interate(): if type(value) == str: if(Meta.genarte_hash(value) == fileValue.hash): return Encoding.decode64BitEncoding(value)
def replaceHash(self, old_value, new_value): current_node = self.head new_node = Node(new_value,current_node.prev, current_node.next) while current_node is not Node: if type(current_node.data) == str: if Meta.genarte_hash(current_node.data) == old_value: current_node.prev.next = new_node current_node.next.prev = new_node return True current_node = current_node.next return False
def removeHash(self,node_value): current_node = self.head while current_node is not None: if type(current_node.data) == str: if Meta.genarte_hash(current_node.data) == node_value: if current_node.prev is not None: current_node.prev.next = current_node.next current_node.next.prev = current_node.prev else: # otherwise we have no prev (it's None), head is the next one, and prev becomes None self.head = current_node.next current_node.next.prev = None return True current_node = current_node.next return False