(entry: T)
| 30 | } |
| 31 | |
| 32 | push(entry: T): void { |
| 33 | const index = (this.head + this._size) % this.capacity; |
| 34 | this.buffer[index] = entry; |
| 35 | if (this._size < this.capacity) { |
| 36 | this._size++; |
| 37 | } else { |
| 38 | // Buffer full — advance head (overwrites oldest) |
| 39 | this.head = (this.head + 1) % this.capacity; |
| 40 | } |
| 41 | this._totalAdded++; |
| 42 | } |
| 43 | |
| 44 | /** Return entries in insertion order (oldest first) */ |
| 45 | toArray(): T[] { |
no outgoing calls