Beispiel #1
0
    def append(self, item):

        if self._size < self._capacity:
            self._vector[self._index] = item
            
        else:
            double = self._capacity * 2
            self._capacity = double
            v1 = Array(double)
            for i in range(len(self)):
                obj = self._vector[i]
                v1[i] = obj
            Array.free(self._vector)
            self._vector = v1
            self._vector[self._index] = item

        self._index = (self._index + 1)
        self._size = (self._size + 1)
Beispiel #2
0
 def __del__(self):
     Array.free(self._vector)