Exemple #1
0
    def fetch(self, address):
        base_addr, index = split_address(address)

        if base_addr not in self.__container.keys():
            self.__resolve_address(base_addr)

        return self.__container[base_addr].get(index)
Exemple #2
0
    def add(self, sequence):
        base_addr, _ = split_address(sequence.address)

        if base_addr in self.__container.keys():
            raise Exception("Invalid sequence")
        else:
            self.__container[base_addr] = sequence
Exemple #3
0
    def get_next_address(self, address):
        base_addr, index = split_address(address)

        if base_addr not in self.__container.keys():
            raise Exception("Invalid address.")

        addr = address

        if index < len(self.__container[base_addr]) - 1:
            addr += 1
        else:
            addr = self.__container[base_addr].next_sequence_address

        return addr