MCPcopy Create free account
hub / github.com/tensorflow/tfjs / constructor

Method constructor

tfjs-data/src/util/ring_buffer.ts:36–45  ·  view source on GitHub ↗

* Constructs a `RingBuffer`. * @param capacity The number of items that the buffer can accomodate.

(public capacity: number)

Source from the content-addressed store, hash-verified

34 * @param capacity The number of items that the buffer can accomodate.
35 */
36 constructor(public capacity: number) {
37 if (capacity == null) {
38 throw new RangeError('Can\'t create a ring buffer of unknown capacity.');
39 }
40 if (capacity < 1) {
41 throw new RangeError('Can\'t create ring buffer of capacity < 1.');
42 }
43 this.data = new Array<T>(capacity);
44 this.doubledCapacity = 2 * capacity;
45 }
46
47 /**
48 * Map any index into the range 0 <= index < 2*capacity.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected